+ else
+ {
+ /* Nothing to do for loose coupling */
+ ODU_PUT_MSG_BUF(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
+ *
+ * ****************************************************************/
+uint8_t packMacStopInd(Pst *pst, OduCellId *cellId)
+{
+ Buffer *mBuf = NULLP;
+
+ if (ODU_GET_MSG_BUF(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(oduUnpackUInt16, cellId->cellId, mBuf);
+ CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
+ cellId = NULL;
+ }
+ else if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
+ }
+ else
+ {
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+
+ return ODU_POST_TASK(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
+ *
+ * ****************************************************************/
+uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ OduCellId *cellId;
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, cellId);
+ }
+ else if(pst->selector == ODU_SELECTOR_LC)
+ {
+ OduCellId cellId;
+ CMCHKUNPK(oduPackUInt16, &(cellId.cellId), mBuf);
+
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, &cellId);
+
+ }
+ else
+ {
+ /* Nothing to do for loose coupling */
+ ODU_PUT_MSG_BUF(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
+ *
+ * ****************************************************************/
+uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)ulCcchIndInfo, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
+ return RFAILED;
+ }
+
+ return ODU_POST_TASK(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
+ *
+ * ****************************************************************/
+uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ UlCcchIndInfo *ulCcchIndInfo;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, ulCcchIndInfo);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
+ ODU_PUT_MSG_BUF(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
+ *
+ * ****************************************************************/
+uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)dlCcchIndInfo, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
+ return RFAILED;
+ }
+
+ return ODU_POST_TASK(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
+ *
+ * ****************************************************************/
+uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ DlCcchIndInfo *dlCcchIndInfo;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, dlCcchIndInfo);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
+ ODU_PUT_MSG_BUF(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 (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCreateReq");
+ return RFAILED;
+ }
+
+ return ODU_POST_TASK(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(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, ueCfg);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\n Only LWLC supported for UE Create Request ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+
+ return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Pack and send UE config response from MAC to DU APP
+ *
+ * @details
+ *
+ * Function : packDuMacUeCfgRsp
+ *
+ * Functionality:
+ * Pack and send UE config response from MAC to DU APP
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCfgRsp");
+ return RFAILED;
+ }
+
+ return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+ *
+ * @brief Unpack UE Config Response from MAC to DU APP
+ *
+ * @details
+ *
+ * Function : unpackDuMacUeCfgRsp
+ *
+ * Functionality: Unpack UE Config Response from MAC to DU APP
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ MacUeCfgRsp *cfgRsp = NULLP;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, cfgRsp);
+ }
+
+ ODU_PUT_MSG_BUF(mBuf);
+ return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Packs and Sends UE Reconig Request from DUAPP to MAC
+ *
+ * @details
+ *
+ * Function : packDuMacUeReconfigReq
+ *
+ * Functionality:
+ * Packs and Sends UE Reconfig Request from DUAPP to MAC
+ *
+ *
+ * @params[in] Post structure pointer
+ * MacUeCfg pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nMAC : Memory allocation failed at packDuMacUeReconfigReq");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nMAC: Only LWLC supported for packDuMacUeReconfigReq");
+ return RFAILED;
+ }
+
+ return ODU_POST_TASK(pst,mBuf);
+}
+/*******************************************************************
+ *
+ * @brief Unpacks UE Reconfig Request received from DU APP
+ *
+ * @details
+ *
+ * Function : unpackMacUeReconfigReq
+ *
+ * Functionality:
+ * Unpacks UE Reconfig Request received from DU APP
+ *
+ * @params[in] Pointer to Handler
+ * Post structure pointer
+ * Message Buffer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ MacUeCfg *ueCfg;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, ueCfg);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\n Only LWLC supported for UE Create Request ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+
+ return RFAILED;