X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fdu_app_mac_inf.c;h=2af744dc19a366b279942f48fdeaeffd6bcff63c;hb=0fccb83e55b237d60cf451bab71a0c7242cc6e66;hp=1a00339ac057a25cd4a010cbc6c35a1b0c6861ce;hpb=e550b2091fb29289d12a5722b189acbede7862f0;p=o-du%2Fl2.git diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 1a00339ac..2af744dc1 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 @@ -53,7 +54,7 @@ * RFAILED - failure * ***************************************************************************/ -uint16_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { if(pst->selector == DU_SELECTOR_LC) { @@ -66,15 +67,16 @@ uint16_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - RETVALUE(RFAILED); + return RFAILED; } /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf); DU_LOG("\nDU-APP : MAC CELL config sent"); - RETVALUE(SPstTsk(pst,mBuf)); + return SPstTsk(pst,mBuf); } + return ROK; } /************************************************************************** @@ -95,7 +97,7 @@ uint16_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) * RFAILED - failure * ***************************************************************************/ -void unpackDuMacCellCfg( +int unpackDuMacCellCfg( DuMacCellCfgReq func, Pst *pst, Buffer *mBuf) @@ -135,21 +137,21 @@ void unpackDuMacCellCfg( * RFAILED - failure * ***************************************************************************/ -uint16_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) { if(pst->selector == DU_SELECTOR_LC) { Buffer *mBuf = NULLP; if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - RETVALUE(RFAILED); + return RFAILED; } /* pack the transaction ID in CNF structure */ CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf); CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf); - RETVALUE(SPstTsk(pst,mBuf)); + return SPstTsk(pst,mBuf); } else if(pst->selector == DU_SELECTOR_LWLC) { @@ -176,7 +178,7 @@ uint16_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) * RFAILED - failure * ***************************************************************************/ -uint16_t unpackMacCellCfgCfm( +int unpackMacCellCfgCfm( DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf) @@ -189,11 +191,12 @@ uint16_t unpackMacCellCfgCfm( CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf); CMCHKUNPK(SUnpkU8, &(macCellCfgCfm.rsp), mBuf); - RETVALUE((*func)(&macCellCfgCfm)); + return (*func)(pst, &macCellCfgCfm); } else { /* only loose coupling is suported */ + return ROK; } } @@ -228,7 +231,7 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); - RETVALUE(RFAILED); + return RFAILED; } /* pack the address of the structure */ @@ -307,7 +310,7 @@ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack"); - RETVALUE(RFAILED); + return RFAILED; } /* pack the address of the structure */ @@ -374,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"); - RETVALUE(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); } /******************************************************************* @@ -418,15 +427,27 @@ 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 */ @@ -436,6 +457,98 @@ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) 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 */ + SPutMsg(mBuf); + return ROK; + } + return ROK; +} /********************************************************************** End of file **********************************************************************/