X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fdu_app_mac_inf.c;h=84dc32f98ca3786480312a4c2723917530095ca0;hb=c946e9243610d6fb122e34674eeab874f7d2f7a4;hp=e0e75c52f6fdf4037a02f6e7660434bdb0430ca0;hpb=86ce8157d6b459515f2a3f37f5bc84daee2d27ca;p=o-du%2Fl2.git diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index e0e75c52f..84dc32f98 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -863,6 +863,7 @@ uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) return ODU_POST_TASK(pst,mBuf); } + /******************************************************************* * * @brief Unpacks UE Reconfig Request received from DU APP @@ -901,6 +902,166 @@ uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf) return RFAILED; } + +/******************************************************************* + * + * @brief Packs and Sends RACH Resource request from DUAPP to MAC + * + * @details + * + * Function : packDuMacRachRsrcReq + * + * Functionality: + * Packs and Sends RACH Resource request from DU APP to MAC + * + * + * @params[in] Post structure pointer + * MacRachRsrcReq pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcReq,"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer, (PTR)rachRsrcReq, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcReq"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks RACH resource Request received from DU APP + * + * @details + * + * Function : unpackMacRachRsrcReq + * + * Functionality: + * Unpacks RACH resource Request received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacRachRsrcReq *rachRsrcReq; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcReq, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, rachRsrcReq); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + +/******************************************************************* + * + * @brief Packs and Sends RACH Resource response from MAC to DU APP + * + * @details + * + * Function : packDuMacRachRsrcRsp + * + * Functionality: + * Packs and Sends RACH Resource response from MAC to DU APP + * + * + * @params[in] Post structure pointer + * MacRachRsrcRsp pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer, (PTR)rachRsrcRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcRsp"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks RACH resource Response received from MAC + * + * @details + * + * Function : unpackDuMacRachRsrcRsp + * + * Functionality: + * Unpacks RACH resource Response received from MAC + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacRachRsrcRsp *rachRsrcRsp; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, rachRsrcRsp); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Response "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} /******************************************************************* * * @brief Packs and Sends UE Delete Request from DUAPP to MAC