X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fdu_app_mac_inf.c;h=05b5662b4692c142b424a6c9413941f4e53709e6;hb=1bed59663a087c96c3ebb984ee19be92e7f4ecc5;hp=408d395281bd47808c87035a1028cd7a94964f85;hpb=451e626d5ac7c7e7586bab23358161230449af46;p=o-du%2Fl2.git diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 408d39528..05b5662b4 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -24,7 +24,6 @@ #include "ss_queue.h" #include "ss_task.h" #include "ss_msg.h" -#include "du_cfg.h" #include "gen.x" /* general */ #include "ssi.x" /* system services */ @@ -34,7 +33,9 @@ #include "cm_hash.x" /* Common Hash List Definitions */ #include "cm_lte.x" /* Common LTE Defines */ +#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 * ***************************************************************************/ -S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { if(pst->selector == DU_SELECTOR_LC) { @@ -66,14 +67,16 @@ S16 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); - RETVALUE(SPstTsk(pst,mBuf)); + DU_LOG("\nDU-APP : MAC CELL config sent"); + return SPstTsk(pst,mBuf); } + return ROK; } /************************************************************************** @@ -94,7 +97,7 @@ S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) * RFAILED - failure * ***************************************************************************/ -void unpackDuMacCellCfg( +int unpackDuMacCellCfg( DuMacCellCfgReq func, Pst *pst, Buffer *mBuf) @@ -123,7 +126,7 @@ void unpackDuMacCellCfg( * * @details * - * Function : cmPackMacCellCfgCfm + * Function : packMacCellCfgCfm * * Functionality: * packs the transaction ID @@ -134,26 +137,28 @@ void unpackDuMacCellCfg( * RFAILED - failure * ***************************************************************************/ -U16 cmPackMacCellCfgCfm(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) { /* only LC is supported */ return RFAILED; } + return ROK; } /************************************************************************** @@ -173,7 +178,7 @@ U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) * RFAILED - failure * ***************************************************************************/ -S16 unpackMacCellCfgCfm( +int unpackMacCellCfgCfm( DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf) @@ -184,13 +189,272 @@ S16 unpackMacCellCfgCfm( { /* unpack the transaction ID in CNF structure */ 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; + } +} + +/******************************************************************* + * + * @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"); + return 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"); + return 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 ) +{ + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); + return RFAILED; + } + + if(pst->selector == DU_SELECTOR_LC) + { + CMCHKPK(SPkU16, slotInfo->cellId, mBuf); + CMCHKPK(SPkU16, slotInfo->sfn, mBuf); + CMCHKPK(SPkU16, slotInfo->slot, mBuf); + + 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); + } + else + { + SPutMsg(mBuf); + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @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) +{ + 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; } /**********************************************************************