X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fdu_app_mac_inf.c;h=ba446929c03d4a5c92ca5cad59216f8c463ae829;hb=4e803fe4bcf3a446b7082675d25d35ad102f16f6;hp=05b5662b4692c142b424a6c9413941f4e53709e6;hpb=1bed59663a087c96c3ebb984ee19be92e7f4ecc5;p=o-du%2Fl2.git diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 05b5662b4..ba446929c 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -14,28 +14,14 @@ # 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 "common_def.h" #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 "du_cfg.h" #include "du_app_mac_inf.h" -#include "cm.h" /************************************************************************** * @brief Function to pack Loose Coupled @@ -56,18 +42,18 @@ ***************************************************************************/ int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { - if(pst->selector == DU_SELECTOR_LC) + if(pst->selector == ODU_SELECTOR_LC) { /* we are now implemented only light wieght lossely coupled interface */ return RFAILED; } - else if(pst->selector == DU_SELECTOR_LWLC) + else if(pst->selector == ODU_SELECTOR_LWLC) { Buffer *mBuf = NULLP; if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - return RFAILED; + return RFAILED; } /* pack the address of the structure */ @@ -98,14 +84,14 @@ int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) * ***************************************************************************/ int unpackDuMacCellCfg( - DuMacCellCfgReq func, - Pst *pst, - Buffer *mBuf) + DuMacCellCfgReq func, + Pst *pst, + Buffer *mBuf) { U16 ret = ROK; MacCellCfg *macCellCfg; - if(pst->selector == DU_SELECTOR_LWLC) + if(pst->selector == ODU_SELECTOR_LWLC) { /* unpack the address of the structure */ CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf); @@ -116,7 +102,7 @@ int unpackDuMacCellCfg( /* only LWLC is implemented now */ ret = ROK; } - + return ret; } @@ -139,21 +125,21 @@ int unpackDuMacCellCfg( ***************************************************************************/ int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) { - if(pst->selector == DU_SELECTOR_LC) + if(pst->selector == ODU_SELECTOR_LC) { Buffer *mBuf = NULLP; if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - return RFAILED; + return RFAILED; } /* pack the transaction ID in CNF structure */ - CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf); + CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf); CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf); return SPstTsk(pst,mBuf); } - else if(pst->selector == DU_SELECTOR_LWLC) + else if(pst->selector == ODU_SELECTOR_LWLC) { /* only LC is supported */ return RFAILED; @@ -179,13 +165,13 @@ int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) * ***************************************************************************/ int unpackMacCellCfgCfm( - DuMacCellCfgCfm func, - Pst *pst, - Buffer *mBuf) + DuMacCellCfgCfm func, + Pst *pst, + Buffer *mBuf) { MacCellCfgCfm macCellCfgCfm; - if(pst->selector == DU_SELECTOR_LC) + if(pst->selector == ODU_SELECTOR_LC) { /* unpack the transaction ID in CNF structure */ CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf); @@ -196,7 +182,7 @@ int unpackMacCellCfgCfm( else { /* only loose coupling is suported */ - return ROK; + return ROK; } } @@ -219,27 +205,27 @@ int unpackMacCellCfgCfm( * ****************************************************************/ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) { - if(pst->selector == DU_SELECTOR_LC) + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LC) { /* Loose coupling not supported */ return RFAILED; } - else if(pst->selector == DU_SELECTOR_LWLC) + else if(pst->selector == ODU_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; + 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; + return SPstTsk(pst,mBuf); } /******************************************************************* @@ -263,8 +249,8 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) { MacCellStartInfo *cellStartInfo; - - if(pst->selector == DU_SELECTOR_LWLC) + + if(pst->selector == ODU_SELECTOR_LWLC) { /* unpack the address of the structure */ CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStartInfo, mBuf); @@ -298,21 +284,21 @@ uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) * ****************************************************************/ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) { - if(pst->selector == DU_SELECTOR_LC) + if(pst->selector == ODU_SELECTOR_LC) { /* Loose coupling not supported */ return RFAILED; } - else if(pst->selector == DU_SELECTOR_LWLC) + else if(pst->selector == ODU_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; + 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); @@ -342,8 +328,8 @@ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) { MacCellStopInfo *cellStopInfo; - - if(pst->selector == DU_SELECTOR_LWLC) + + if(pst->selector == ODU_SELECTOR_LWLC) { /* unpack the address of the structure */ CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStopInfo, mBuf); @@ -378,23 +364,23 @@ uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) 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) + + if(pst->selector == ODU_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; + slotInfo = NULL; } - else if(pst->selector == DU_SELECTOR_LWLC) + else if(pst->selector == ODU_SELECTOR_LWLC) { /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)slotInfo, mBuf); @@ -427,7 +413,7 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) * ****************************************************************/ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) { - if(pst->selector == DU_SELECTOR_LWLC) + if(pst->selector == ODU_SELECTOR_LWLC) { SlotInfo *slotInfo; @@ -436,7 +422,7 @@ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) SPutMsg(mBuf); return (*func)(pst, slotInfo); } - else if(pst->selector == DU_SELECTOR_LC) + else if(pst->selector == ODU_SELECTOR_LC) { SlotInfo slotInfo; @@ -457,6 +443,407 @@ 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 == ODU_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 == ODU_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 == ODU_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 == ODU_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; +} + +/******************************************************************* + * + * @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 == ODU_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 == ODU_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 == ODU_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 == ODU_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; +} + +/******************************************************************* + * + * @brief Packs and Sends UE create Request from DUAPP to MAC + * + * @details + * + * Function : packDuMacUeCreateReq + * + * Functionality: + * Packs and Sends UE Create Request from DUAPP to MAC + * + * + * @params[in] Post structure pointer + * MacUeCfg pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)ueCfg, mBuf); + } + else + { + DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCreateReq"); + return RFAILED; + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks UE Create Request received from DU APP + * + * @details + * + * Function : unpackMacUeCreateReq + * + * Functionality: + * Unpacks UE Create Request received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeCfg *ueCfg; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&ueCfg, mBuf); + SPutMsg(mBuf); + return (*func)(pst, ueCfg); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\n Only LWLC supported for UE Create Request "); + SPutMsg(mBuf); + } + + return RFAILED; +} + +/******************************************************************* + * + * @brief Pack and send UE config response from MAC to DU APP + * + * @details + * + * Function : packDuMacUeCreateRsp + * + * Functionality: + * Pack and send UE config response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)cfgRsp, mBuf); + } + else + { + DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCfgRsp"); + return RFAILED; + } + + return SPstTsk(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpack UE Config Response from MAC to DU APP + * + * @details + * + * Function : unpackDuMacUeCreateRsp + * + * Functionality: Unpack UE Config Response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeCfgRsp *cfgRsp; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&cfgRsp, mBuf); + SPutMsg(mBuf); + return (*func)(pst, cfgRsp); + } + + SPutMsg(mBuf); + return RFAILED; +} + /********************************************************************** - End of file -**********************************************************************/ + End of file + **********************************************************************/