X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fdu_app_mac_inf.c;h=3ade19478944e99232d2ff0f55463bcb230cc2f9;hb=e006592159c0a16a4c2f24cc50f712ff9461a000;hp=57068bbd46784f703796a93fee550b78bb5b8991;hpb=8340c342ebcfc82193c3f66e7f15047c1e37399b;p=o-du%2Fl2.git diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 57068bbd4..3ade19478 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -35,6 +35,7 @@ #include "du_cfg.h" #include "du_app_mac_inf.h" +#include "cm.h" /************************************************************************** * @brief Function to pack Loose Coupled @@ -218,6 +219,8 @@ int unpackMacCellCfgCfm( * ****************************************************************/ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) { + Buffer *mBuf = NULLP; + if(pst->selector == DU_SELECTOR_LC) { /* Loose coupling not supported */ @@ -225,7 +228,6 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) } else if(pst->selector == DU_SELECTOR_LWLC) { - Buffer *mBuf = NULLP; if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { @@ -236,9 +238,8 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)cellStartInfo, mBuf); - return SPstTsk(pst,mBuf); } - return ROK; + return SPstTsk(pst,mBuf); } /******************************************************************* @@ -376,28 +377,34 @@ uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) * ****************************************************************/ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) { - if(pst->selector == DU_SELECTOR_LC || pst->selector == DU_SELECTOR_TC) + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - /* Loose coupling not supported */ - DU_LOG("\nDU APP : Only LWLC supported"); + DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); return RFAILED; } - else if(pst->selector == DU_SELECTOR_LWLC) + + if(pst->selector == DU_SELECTOR_LC) { - Buffer *mBuf = NULLP; + CMCHKPK(SPkU16, slotInfo->cellId, mBuf); + CMCHKPK(SPkU16, slotInfo->sfn, mBuf); + CMCHKPK(SPkU16, slotInfo->slot, mBuf); - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) - { - DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); - return RFAILED; - } - + CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotInfo)); + slotInfo = NULL; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)slotInfo, mBuf); - - return SPstTsk(pst,mBuf); } - return ROK; + else + { + SPutMsg(mBuf); + } + + return SPstTsk(pst,mBuf); } /******************************************************************* @@ -420,15 +427,120 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) * ****************************************************************/ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) { - SlotInfo *slotInfo; - if(pst->selector == DU_SELECTOR_LWLC) { + SlotInfo *slotInfo; + /* unpack the address of the structure */ CMCHKUNPK(cmUnpkPtr, (PTR *)&slotInfo, mBuf); SPutMsg(mBuf); return (*func)(pst, slotInfo); } + else if(pst->selector == DU_SELECTOR_LC) + { + SlotInfo slotInfo; + + CMCHKUNPK(SUnpkU16, &(slotInfo.slot), mBuf); + CMCHKUNPK(SUnpkU16, &(slotInfo.sfn), mBuf); + CMCHKUNPK(SUnpkU16, &(slotInfo.cellId), mBuf); + + SPutMsg(mBuf); + return (*func)(pst, &slotInfo); + + } + else + { + /* Nothing to do for loose coupling */ + SPutMsg(mBuf); + return ROK; + } + return ROK; +} + +/******************************************************************* + * + * @brief Packs and Sends stop ind from MAC to DUAPP + * + * @details + * + * Function : packMacStopInd + * + * Functionality: + * Packs and Sends stop ind from MAC to DUAPP + * + * @params[in] Post structure pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId) +{ + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nDU APP : Memory allocation failed for stop Ind pack"); + return RFAILED; + } + + if(pst->selector == DU_SELECTOR_LC) + { + /*pack the payload here*/ + DU_LOG("\nDU APP : Packed CellId"); + CMCHKPK(SPkU16, cellStopId->cellId, mBuf); + CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopId, sizeof(MacCellStopInfo)); + cellStopId = NULL; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)cellStopId, mBuf); + } + else + { + SPutMsg(mBuf); + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks stop indication from MAC + * + * @details + * + * Function : unpackMacStopInd + * + * Functionality: + * Unpacks stop indication from MAC + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == DU_SELECTOR_LWLC) + { + MacCellStopInfo *cellStopId; + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStopId, mBuf); + SPutMsg(mBuf); + return (*func)(pst, cellStopId); + } + else if(pst->selector == DU_SELECTOR_LC) + { + MacCellStopInfo cellStopId; + CMCHKUNPK(SUnpkU16, &(cellStopId.cellId), mBuf); + + SPutMsg(mBuf); + return (*func)(pst, &cellStopId); + + } else { /* Nothing to do for loose coupling */ @@ -438,6 +550,166 @@ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) return ROK; } +/******************************************************************* + * + * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP + * + * @details + * + * Function : packMacUlCcchInd + * + * Functionality: + * Packs and Sends UL CCCH Ind from MAC to DUAPP + * + * @params[in] Post structure pointer + * UL CCCH Ind pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == DU_SELECTOR_LWLC) + { + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)ulCcchIndInfo, mBuf); + } + else + { + DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind "); + return RFAILED; + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks UL CCCH indication from MAC + * + * @details + * + * Function : unpackMacUlCcchInd + * + * Functionality: + * Unpacks UL CCCH indication from MAC + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == DU_SELECTOR_LWLC) + { + UlCcchIndInfo *ulCcchIndInfo; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&ulCcchIndInfo, mBuf); + SPutMsg(mBuf); + return (*func)(pst, ulCcchIndInfo); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\n Only LWLC supported for UL CCCH Ind "); + SPutMsg(mBuf); + } + return RFAILED; +} + +/******************************************************************* + * + * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC + * + * @details + * + * Function : packMacDlCcchInd + * + * Functionality: + * Packs and Sends DL CCCH Ind from DUAPP to MAC + * + * + * @params[in] Post structure pointer + * DL CCCH Ind pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == DU_SELECTOR_LWLC) + { + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)dlCcchIndInfo, mBuf); + } + else + { + DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind "); + return RFAILED; + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks DL CCCH indication from DU APP + * + * @details + * + * Function : unpackMacDlCcchInd + * + * Functionality: + * Unpacks DL CCCH indication from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == DU_SELECTOR_LWLC) + { + DlCcchIndInfo *dlCcchIndInfo; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&dlCcchIndInfo, mBuf); + SPutMsg(mBuf); + return (*func)(pst, dlCcchIndInfo); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\n Only LWLC supported for DL CCCH Ind "); + SPutMsg(mBuf); + } + + return RFAILED; +} + + + /********************************************************************** End of file **********************************************************************/