1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 #include "common_def.h"
20 #include "du_app_mac_inf.h"
22 /**************************************************************************
23 * @brief Function to pack Loose Coupled
24 * MAC cell config parameters required by MAC
28 * Function : packMacCellCfg
31 * packs the macCellCfg parameters
33 * @param[in] Pst *pst, Post structure of the primitive.
34 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
35 * @return ROK - success
38 ***************************************************************************/
39 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
41 if(pst->selector == ODU_SELECTOR_LC)
43 /* we are now implemented only light wieght lossely coupled interface */
46 else if(pst->selector == ODU_SELECTOR_LWLC)
50 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
55 /* pack the address of the structure */
56 CMCHKPK(oduPackPointer,(PTR)macCellCfg, mBuf);
58 DU_LOG("\nDEBUG --> DU-APP : MAC CELL config sent");
59 return ODU_POST_TASK(pst,mBuf);
64 /**************************************************************************
65 * @brief Function to pack Loose Coupled
66 * MAC cell config parameters required by MAC
70 * Function : unpackDuMacCellCfg
73 * packs the macCellCfg parameters
75 * @param[in] DuMacCellCfgReq func; function pointer
76 * @param[in] Pst *pst, Post structure of the primitive.
77 * @param[in] Buffer *mBuf
78 * @return ROK - success
81 ***************************************************************************/
82 uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf)
85 MacCellCfg *macCellCfg;
87 if(pst->selector == ODU_SELECTOR_LWLC)
89 /* unpack the address of the structure */
90 CMCHKUNPK(oduUnpackPointer, (PTR *)&macCellCfg, mBuf);
91 ret = (*func)(pst, macCellCfg);
95 /* only LWLC is implemented now */
102 /**************************************************************************
103 * @brief Function to pack Loose Coupled
104 * MAC cell config confirm message
108 * Function : packMacCellCfgCfm
111 * packs the transaction ID
113 * @param[in] Pst *pst, Post structure of the primitive.
114 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
115 * @return ROK - success
118 ***************************************************************************/
119 uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
121 if(pst->selector == ODU_SELECTOR_LC)
123 Buffer *mBuf = NULLP;
124 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
129 /* pack the transaction ID in CNF structure */
130 CMCHKPK(oduUnpackUInt16, macCellCfgCfm->cellId, mBuf);
131 CMCHKPK(oduUnpackUInt8, macCellCfgCfm->rsp, mBuf);
133 return ODU_POST_TASK(pst,mBuf);
135 else if(pst->selector == ODU_SELECTOR_LWLC)
137 /* only LC is supported */
143 /**************************************************************************
144 * @brief Function to pack MAC cell config confirm message
148 * Function : unpackMacCellCfgCfm
151 * packs the transaction ID
153 * @param[in] DuMacCellCfgCfm func; function pointer
154 * @param[in] Pst *pst, Post structure of the primitive.
155 * @param[in] Buffer *mBuf
156 * @return ROK - success
159 ***************************************************************************/
160 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf)
162 MacCellCfgCfm macCellCfgCfm;
164 if(pst->selector == ODU_SELECTOR_LC)
166 /* unpack the transaction ID in CNF structure */
167 CMCHKUNPK(oduPackUInt8, &(macCellCfgCfm.rsp), mBuf);
168 CMCHKUNPK(oduPackUInt16, &(macCellCfgCfm.cellId), mBuf);
169 return (*func)(pst, &macCellCfgCfm);
173 /* only loose coupling is suported */
178 /*******************************************************************
180 * @brief Packs and Send Cell Start Request to MAC
184 * Function : packMacCellStart
187 * Packs and Sends Cell Start Request to MAC
189 * @params[in] Post structure pointer
191 * @return ROK - success
194 * ****************************************************************/
195 uint8_t packMacCellStart(Pst *pst, CellStartInfo *cellStart)
197 Buffer *mBuf = NULLP;
199 if(pst->selector == ODU_SELECTOR_LC)
201 /* Loose coupling not supported */
204 else if(pst->selector == ODU_SELECTOR_LWLC)
207 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
209 DU_LOG("\nERROR --> DU APP : Memory allocation failed for cell start req pack");
213 /* pack the address of the structure */
214 CMCHKPK(oduPackPointer,(PTR)cellStart, mBuf);
217 return ODU_POST_TASK(pst,mBuf);
220 /*******************************************************************
222 * @brief Unpacks MAC Cell Start Request from DU APP
226 * Function : unpackMaCellStart
229 * Unpacks MAC Cell Start Request from DU APP
231 * @params[in] Function pointer of cell start request handler
232 * Post structure pointer
234 * @return ROK - success
237 * ****************************************************************/
238 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf)
240 CellStartInfo *cellStart;
242 if(pst->selector == ODU_SELECTOR_LWLC)
244 /* unpack the address of the structure */
245 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStart, mBuf);
246 ODU_PUT_MSG_BUF(mBuf);
247 return (*func)(pst, cellStart);
251 /* Nothing to do for loose coupling */
252 ODU_PUT_MSG_BUF(mBuf);
257 /*******************************************************************
259 * @brief Packs and Send cell stop request to MAC
263 * Function : packMacCellStop
266 * Packs and Send cell stop request to MAC
268 * @params[in] Post structure pointer
270 * @return ROK - success
273 * ****************************************************************/
274 uint8_t packMacCellStop(Pst *pst, CellStopInfo *cellStop)
276 if(pst->selector == ODU_SELECTOR_LC)
278 /* Loose coupling not supported */
281 else if(pst->selector == ODU_SELECTOR_LWLC)
283 Buffer *mBuf = NULLP;
285 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
287 DU_LOG("\nERROR --> DU APP : Memory allocation failed for cell stop req pack");
291 /* pack the address of the structure */
292 CMCHKPK(oduPackPointer,(PTR)cellStop, mBuf);
294 return ODU_POST_TASK(pst,mBuf);
299 /*******************************************************************
301 * @brief Unpacks cell stop request from DU APP
305 * Function : unpackMaCellStop
308 * Unpacks cell stop request from DU APP
310 * @params[in] Handler function pointer
311 * Post structure pointer
313 * @return ROK - success
316 * ****************************************************************/
317 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf)
319 CellStopInfo *cellStop;
321 if(pst->selector == ODU_SELECTOR_LWLC)
323 /* unpack the address of the structure */
324 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStop, mBuf);
325 ODU_PUT_MSG_BUF(mBuf);
326 return (*func)(pst, cellStop);
330 /* Nothing to do for loose coupling */
331 ODU_PUT_MSG_BUF(mBuf);
336 /*******************************************************************
338 * @brief Packs and Sends cell up ind from MAC to DUAPP
342 * Function : packMacCellUpInd
345 * Packs and Sends cell up ind from MAC to DUAPP
347 * @params[in] Post structure pointer
349 * @return ROK - success
352 * ****************************************************************/
353 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId)
355 Buffer *mBuf = NULLP;
357 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
359 DU_LOG("\nERROR --> DU APP : Memory allocation failed for packMacCellUpInd");
363 if(pst->selector == ODU_SELECTOR_LC)
365 CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
366 CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
369 else if(pst->selector == ODU_SELECTOR_LWLC)
371 /* pack the address of the structure */
372 CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
376 ODU_PUT_MSG_BUF(mBuf);
379 return ODU_POST_TASK(pst, mBuf);
382 /*******************************************************************
384 * @brief Unpacks cell up indication from MAC
388 * Function : unpackMacCellUpInd
391 * Unpacks cell up indication from MAC
393 * @params[in] Pointer to Handler
394 * Post structure pointer
396 * @return ROK - success
399 * ****************************************************************/
400 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf)
402 if(pst->selector == ODU_SELECTOR_LWLC)
406 /* unpack the address of the structure */
407 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
408 ODU_PUT_MSG_BUF(mBuf);
409 return (*func)(pst, cellId);
411 else if(pst->selector == ODU_SELECTOR_LC)
414 CMCHKUNPK(oduPackUInt16, &cellId.cellId, mBuf);
415 ODU_PUT_MSG_BUF(mBuf);
416 return (*func)(pst, &cellId);
420 /* Nothing to do for loose coupling */
421 ODU_PUT_MSG_BUF(mBuf);
427 /*******************************************************************
429 * @brief Packs and Sends stop ind from MAC to DUAPP
433 * Function : packMacStopInd
436 * Packs and Sends stop ind from MAC to DUAPP
438 * @params[in] Post structure pointer
439 * @return ROK - success
442 * ****************************************************************/
443 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId)
445 Buffer *mBuf = NULLP;
447 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
449 DU_LOG("\nERROR --> DU APP : Memory allocation failed for stop Ind pack");
453 if(pst->selector == ODU_SELECTOR_LC)
455 /*pack the payload here*/
456 CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
457 CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
460 else if(pst->selector == ODU_SELECTOR_LWLC)
462 /* pack the address of the structure */
463 CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
467 ODU_PUT_MSG_BUF(mBuf);
470 return ODU_POST_TASK(pst,mBuf);
473 /*******************************************************************
475 * @brief Unpacks stop indication from MAC
479 * Function : unpackMacStopInd
482 * Unpacks stop indication from MAC
484 * @params[in] Pointer to Handler
485 * Post structure pointer
487 * @return ROK - success
490 * ****************************************************************/
491 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
493 if(pst->selector == ODU_SELECTOR_LWLC)
495 OduCellId *cellId=NULLP;
496 /* unpack the address of the structure */
497 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
498 ODU_PUT_MSG_BUF(mBuf);
499 return (*func)(pst, cellId);
501 else if(pst->selector == ODU_SELECTOR_LC)
504 CMCHKUNPK(oduPackUInt16, &(cellId.cellId), mBuf);
506 ODU_PUT_MSG_BUF(mBuf);
507 return (*func)(pst, &cellId);
512 /* Nothing to do for loose coupling */
513 ODU_PUT_MSG_BUF(mBuf);
519 /*******************************************************************
521 * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP
525 * Function : packMacUlCcchInd
528 * Packs and Sends UL CCCH Ind from MAC to DUAPP
530 * @params[in] Post structure pointer
531 * UL CCCH Ind pointer
532 * @return ROK - success
535 * ****************************************************************/
536 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
538 Buffer *mBuf = NULLP;
540 if(pst->selector == ODU_SELECTOR_LWLC)
542 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
544 DU_LOG("\nERROR --> MAC : Memory allocation failed at packMacUlCcchInd");
547 /* pack the address of the structure */
548 CMCHKPK(oduPackPointer,(PTR)ulCcchIndInfo, mBuf);
552 DU_LOG("\nERROR --> MAC: Only LWLC supported for UL CCCH Ind ");
556 return ODU_POST_TASK(pst,mBuf);
559 /*******************************************************************
561 * @brief Unpacks UL CCCH indication from MAC
565 * Function : unpackMacUlCcchInd
568 * Unpacks UL CCCH indication from MAC
570 * @params[in] Pointer to Handler
571 * Post structure pointer
573 * @return ROK - success
576 * ****************************************************************/
577 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
579 if(pst->selector == ODU_SELECTOR_LWLC)
581 UlCcchIndInfo *ulCcchIndInfo;
583 /* unpack the address of the structure */
584 CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf);
585 ODU_PUT_MSG_BUF(mBuf);
586 return (*func)(pst, ulCcchIndInfo);
590 /* Nothing to do for other selectors */
591 DU_LOG("\nERROR --> MAC : Only LWLC supported for UL CCCH Ind ");
592 ODU_PUT_MSG_BUF(mBuf);
597 /*******************************************************************
599 * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC
603 * Function : packMacDlCcchInd
606 * Packs and Sends DL CCCH Ind from DUAPP to MAC
609 * @params[in] Post structure pointer
610 * DL CCCH Ind pointer
611 * @return ROK - success
614 * ****************************************************************/
615 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
617 Buffer *mBuf = NULLP;
619 if(pst->selector == ODU_SELECTOR_LWLC)
621 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
623 DU_LOG("\nERROR --> MAC : Memory allocation failed at packMacDlCcchInd");
626 /* pack the address of the structure */
627 CMCHKPK(oduPackPointer,(PTR)dlCcchIndInfo, mBuf);
631 DU_LOG("\nERROR --> DU APP : Only LWLC supported for DL CCCH Ind ");
635 return ODU_POST_TASK(pst,mBuf);
638 /*******************************************************************
640 * @brief Unpacks DL CCCH indication from DU APP
644 * Function : unpackMacDlCcchInd
647 * Unpacks DL CCCH indication from DU APP
649 * @params[in] Pointer to Handler
650 * Post structure pointer
652 * @return ROK - success
655 * ****************************************************************/
656 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
658 if(pst->selector == ODU_SELECTOR_LWLC)
660 DlCcchIndInfo *dlCcchIndInfo;
662 /* unpack the address of the structure */
663 CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf);
664 ODU_PUT_MSG_BUF(mBuf);
665 return (*func)(pst, dlCcchIndInfo);
669 /* Nothing to do for other selectors */
670 DU_LOG("\nERROR --> DU APP : Only LWLC supported for DL CCCH Ind ");
671 ODU_PUT_MSG_BUF(mBuf);
677 /*******************************************************************
679 * @brief Packs and Sends UE create Request from DUAPP to MAC
683 * Function : packDuMacUeCreateReq
686 * Packs and Sends UE Create Request from DUAPP to MAC
689 * @params[in] Post structure pointer
690 * MacUeCreateReq pointer
691 * @return ROK - success
694 * ****************************************************************/
695 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg)
697 Buffer *mBuf = NULLP;
699 if(pst->selector == ODU_SELECTOR_LWLC)
701 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
703 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeCreateReq");
706 /* pack the address of the structure */
707 CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
711 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeCreateReq");
715 return ODU_POST_TASK(pst,mBuf);
718 /*******************************************************************
720 * @brief Unpacks UE Create Request received from DU APP
724 * Function : unpackMacUeCreateReq
727 * Unpacks UE Create Request received from DU APP
729 * @params[in] Pointer to Handler
730 * Post structure pointer
732 * @return ROK - success
735 * ****************************************************************/
736 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
738 if(pst->selector == ODU_SELECTOR_LWLC)
740 MacUeCreateReq *ueCfg;
742 /* unpack the address of the structure */
743 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
744 ODU_PUT_MSG_BUF(mBuf);
745 return (*func)(pst, ueCfg);
749 /* Nothing to do for other selectors */
750 DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Create Request ");
751 ODU_PUT_MSG_BUF(mBuf);
757 /*******************************************************************
759 * @brief Pack and send UE create response from MAC to DU APP
763 * Function : packDuMacUeCreateRsp
766 * Pack and send UE create response from MAC to DU APP
769 * @return ROK - success
772 * ****************************************************************/
773 uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp)
775 Buffer *mBuf = NULLP;
777 if(pst->selector == ODU_SELECTOR_LWLC)
779 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
781 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeCreateRsp");
784 /* pack the address of the structure */
785 CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
789 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeCreateRsp");
793 return ODU_POST_TASK(pst,mBuf);
795 /*******************************************************************
797 * @brief Unpack UE Create Response from MAC to DU APP
801 * Function :unpackDuMacUeCreateRsp
803 * Functionality: Unpack UE Create Response from MAC to DU APP
806 * @return ROK - success
809 * ****************************************************************/
810 uint8_t unpackDuMacUeCreateRsp(MacDuUeCreateRspFunc func, Pst *pst, Buffer *mBuf)
812 if(pst->selector == ODU_SELECTOR_LWLC)
814 MacUeCreateRsp *cfgRsp = NULLP;
816 /* unpack the address of the structure */
817 CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
818 ODU_PUT_MSG_BUF(mBuf);
819 return (*func)(pst, cfgRsp);
822 ODU_PUT_MSG_BUF(mBuf);
826 /*******************************************************************
828 * @brief Packs and Sends UE Reconig Request from DUAPP to MAC
832 * Function : packDuMacUeReconfigReq
835 * Packs and Sends UE Reconfig Request from DUAPP to MAC
838 * @params[in] Post structure pointer
840 * @return ROK - success
843 * ****************************************************************/
844 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueCfg)
846 Buffer *mBuf = NULLP;
848 if(pst->selector == ODU_SELECTOR_LWLC)
850 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
852 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeReconfigReq");
855 /* pack the address of the structure */
856 CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
860 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeReconfigReq");
864 return ODU_POST_TASK(pst,mBuf);
867 /*******************************************************************
869 * @brief Unpacks UE Reconfig Request received from DU APP
873 * Function : unpackMacUeReconfigReq
876 * Unpacks UE Reconfig Request received from DU APP
878 * @params[in] Pointer to Handler
879 * Post structure pointer
881 * @return ROK - success
884 * ****************************************************************/
885 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf)
887 if(pst->selector == ODU_SELECTOR_LWLC)
891 /* unpack the address of the structure */
892 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueRecfg, mBuf);
893 ODU_PUT_MSG_BUF(mBuf);
894 return (*func)(pst, ueRecfg);
898 /* Nothing to do for other selectors */
899 DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Create Request ");
900 ODU_PUT_MSG_BUF(mBuf);
906 /*******************************************************************
908 * @brief Pack and send UE Reconfig response from MAC to DU APP
912 * Function : packDuMacUeRecfgRsp
915 * Pack and send UE Reconfig response from MAC to DU APP
918 * @return ROK - success
921 * ****************************************************************/
922 uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp)
924 Buffer *mBuf = NULLP;
926 if(pst->selector == ODU_SELECTOR_LWLC)
928 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
930 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeRecfgRsp");
933 /* pack the address of the structure */
934 CMCHKPK(oduPackPointer,(PTR)recfgRsp, mBuf);
938 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeRecfgRsp");
942 return ODU_POST_TASK(pst,mBuf);
945 /*******************************************************************
947 * @brief Unpack UE ReConfig Response from MAC to DU APP
951 * Function :unpackDuMacUeRecfgRsp
953 * Functionality: Unpack UE ReConfig Response from MAC to DU APP
956 * @return ROK - success
959 * ****************************************************************/
960 uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf)
962 if(pst->selector == ODU_SELECTOR_LWLC)
964 MacUeRecfgRsp *recfgRsp = NULLP;
966 /* unpack the address of the structure */
967 CMCHKUNPK(oduUnpackPointer, (PTR *)&recfgRsp, mBuf);
968 ODU_PUT_MSG_BUF(mBuf);
969 return (*func)(pst, recfgRsp);
972 ODU_PUT_MSG_BUF(mBuf);
976 /*******************************************************************
978 * @brief Packs and Sends RACH Resource request from DUAPP to MAC
982 * Function : packDuMacRachRsrcReq
985 * Packs and Sends RACH Resource request from DU APP to MAC
988 * @params[in] Post structure pointer
989 * MacRachRsrcReq pointer
990 * @return ROK - success
993 * ****************************************************************/
994 uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq)
996 Buffer *mBuf = NULLP;
998 if(pst->selector == ODU_SELECTOR_LWLC)
1000 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1002 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcReq,");
1005 /* pack the address of the structure */
1006 CMCHKPK(oduPackPointer, (PTR)rachRsrcReq, mBuf);
1010 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcReq");
1014 return ODU_POST_TASK(pst,mBuf);
1017 /*******************************************************************
1019 * @brief Unpacks RACH resource Request received from DU APP
1023 * Function : unpackMacRachRsrcReq
1026 * Unpacks RACH resource Request received from DU APP
1028 * @params[in] Pointer to Handler
1029 * Post structure pointer
1031 * @return ROK - success
1034 * ****************************************************************/
1035 uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf)
1037 if(pst->selector == ODU_SELECTOR_LWLC)
1039 MacRachRsrcReq *rachRsrcReq;
1041 /* unpack the address of the structure */
1042 CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcReq, mBuf);
1043 ODU_PUT_MSG_BUF(mBuf);
1044 return (*func)(pst, rachRsrcReq);
1048 /* Nothing to do for other selectors */
1049 DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Request ");
1050 ODU_PUT_MSG_BUF(mBuf);
1056 /*******************************************************************
1058 * @brief Packs and Sends RACH Resource release from DUAPP to MAC
1062 * Function : packDuMacRachRsrcRel
1065 * Packs and Sends RACH Resource release from DU APP to MAC
1068 * @params[in] Post structure pointer
1069 * MacRachRsrcRel pointer
1070 * @return ROK - success
1073 * ****************************************************************/
1074 uint8_t packDuMacRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel)
1076 Buffer *mBuf = NULLP;
1078 if(pst->selector == ODU_SELECTOR_LWLC)
1080 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1082 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcRel");
1085 /* pack the address of the structure */
1086 CMCHKPK(oduPackPointer, (PTR)rachRsrcRel, mBuf);
1090 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcRel");
1094 return ODU_POST_TASK(pst,mBuf);
1097 /*******************************************************************
1099 * @brief Unpacks RACH Resource Release received from DU APP
1103 * Function : unpackMacRachRsrcRel
1106 * Unpacks RACH Resource Release received from DU APP
1108 * @params[in] Pointer to Handler
1109 * Post structure pointer
1111 * @return ROK - success
1114 * ****************************************************************/
1115 uint8_t unpackMacRachRsrcRel(DuMacRachRsrcRel func, Pst *pst, Buffer *mBuf)
1117 if(pst->selector == ODU_SELECTOR_LWLC)
1119 MacRachRsrcRel *rachRsrcRel;
1121 /* unpack the address of the structure */
1122 CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRel, mBuf);
1123 ODU_PUT_MSG_BUF(mBuf);
1124 return (*func)(pst, rachRsrcRel);
1128 /* Nothing to do for other selectors */
1129 DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH Resource Release ");
1130 ODU_PUT_MSG_BUF(mBuf);
1136 /*******************************************************************
1138 * @brief Packs and Sends RACH Resource response from MAC to DU APP
1142 * Function : packDuMacRachRsrcRsp
1145 * Packs and Sends RACH Resource response from MAC to DU APP
1148 * @params[in] Post structure pointer
1149 * MacRachRsrcRsp pointer
1150 * @return ROK - success
1153 * ****************************************************************/
1154 uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp)
1156 Buffer *mBuf = NULLP;
1158 if(pst->selector == ODU_SELECTOR_LWLC)
1160 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1162 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcRsp");
1165 /* pack the address of the structure */
1166 CMCHKPK(oduPackPointer, (PTR)rachRsrcRsp, mBuf);
1170 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcRsp");
1174 return ODU_POST_TASK(pst,mBuf);
1177 /*******************************************************************
1179 * @brief Unpacks RACH resource Response received from MAC
1183 * Function : unpackDuMacRachRsrcRsp
1186 * Unpacks RACH resource Response received from MAC
1188 * @params[in] Pointer to Handler
1189 * Post structure pointer
1191 * @return ROK - success
1194 * ****************************************************************/
1195 uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf)
1197 if(pst->selector == ODU_SELECTOR_LWLC)
1199 MacRachRsrcRsp *rachRsrcRsp;
1201 /* unpack the address of the structure */
1202 CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRsp, mBuf);
1203 ODU_PUT_MSG_BUF(mBuf);
1204 return (*func)(pst, rachRsrcRsp);
1208 /* Nothing to do for other selectors */
1209 DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Response ");
1210 ODU_PUT_MSG_BUF(mBuf);
1215 /*******************************************************************
1217 * @brief Packs and Sends UE Delete Request from DUAPP to MAC
1221 * Function : packDuMacUeDeleteReq
1224 * Packs and Sends UE Delete Request from DUAPP to MAC
1227 * @params[in] Post structure pointer
1228 * MacUeDelete pointer
1229 * @return ROK - success
1232 * ****************************************************************/
1233 uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDel)
1235 Buffer *mBuf = NULLP;
1237 if(pst->selector == ODU_SELECTOR_LWLC)
1239 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1241 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeDeleteReq");
1244 /* pack the address of the structure */
1245 CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
1249 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeDeleteReq");
1253 return ODU_POST_TASK(pst,mBuf);
1255 /*******************************************************************
1257 * @brief Unpacks UE Delete Request received from DU APP
1261 * Function : unpackMacUeDeleteReq
1264 * Unpacks UE Delete Request received from DU APP
1266 * @params[in] Pointer to Handler
1267 * Post structure pointer
1269 * @return ROK - success
1272 * ****************************************************************/
1273 uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf)
1275 if(pst->selector == ODU_SELECTOR_LWLC)
1277 MacUeDelete *ueDelete;
1279 /* unpack the address of the structure */
1280 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
1281 ODU_PUT_MSG_BUF(mBuf);
1282 return (*func)(pst, ueDelete);
1286 /* Nothing to do for other selectors */
1287 DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Delete Request ");
1288 ODU_PUT_MSG_BUF(mBuf);
1293 /*******************************************************************
1295 * @brief Pack and send UE delete response from MAC to DU APP
1299 * Function : packDuMacUeDeleteRsp
1302 * Pack and send UE delete response from MAC to DU APP
1305 * @return ROK - success
1308 * ****************************************************************/
1309 uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
1311 Buffer *mBuf = NULLP;
1313 if(pst->selector == ODU_SELECTOR_LWLC)
1315 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1317 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeDeleteRsp");
1320 /* pack the address of the structure */
1321 CMCHKPK(oduPackPointer,(PTR)deleteRsp, mBuf);
1325 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeDeleteRsp");
1329 return ODU_POST_TASK(pst,mBuf);
1333 /*******************************************************************
1335 * @brief Unpack UE Config Response from MAC to DU APP
1339 * Function :unpackDuMacUeDeleteRsp
1341 * Functionality: Unpack UE Config Response from MAC to DU APP
1344 * @return ROK - success
1347 * ****************************************************************/
1348 uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf)
1350 if(pst->selector == ODU_SELECTOR_LWLC)
1352 MacUeDeleteRsp *ueDeleteRsp = NULLP;
1354 /* unpack the address of the structure */
1355 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDeleteRsp, mBuf);
1356 ODU_PUT_MSG_BUF(mBuf);
1357 return (*func)(pst, ueDeleteRsp);
1360 ODU_PUT_MSG_BUF(mBuf);
1364 /*******************************************************************
1366 * @brief Unpacks Cell Delete Request received from DU APP
1370 * Function : unpackMacCellDeleteReq
1373 * Unpacks Cell Delete Request received from DU APP
1375 * @params[in] Pointer to Handler
1376 * Post structure pointer
1378 * @return ROK - success
1381 * ****************************************************************/
1383 uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf)
1385 if(pst->selector == ODU_SELECTOR_LWLC)
1387 MacCellDeleteReq *cellDelete=NULLP;
1389 /* unpack the address of the structure */
1390 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDelete, mBuf);
1391 ODU_PUT_MSG_BUF(mBuf);
1392 return (*func)(pst, cellDelete);
1396 /* Nothing to do for other
1398 DU_LOG("\nERROR --> DU APP : unpackMacCellDeleteReq(): Only LWLC supported for CELL Delete Request ");
1399 ODU_PUT_MSG_BUF(mBuf);
1405 /*******************************************************************
1407 * @brief Pack and send Cell delete request to MAC
1411 * Function : packDuMacCellDeleteReq
1414 * Pack and send Cell delete request to MAC
1416 * @params[in] Post structure
1417 * MacCellDelete *cellDelete;
1418 * @return ROK - success
1421 * ****************************************************************/
1423 uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete)
1425 Buffer *mBuf = NULLP;
1427 if(pst->selector == ODU_SELECTOR_LWLC)
1429 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1431 DU_LOG("\nERROR --> MAC : packDuMacCellDeleteReq(): Memory allocation failed ");
1434 CMCHKPK(oduPackPointer,(PTR)cellDelete, mBuf);
1435 return ODU_POST_TASK(pst,mBuf);
1439 DU_LOG("\nERROR --> MAC: packDuMacCellDeleteReq(): Only LWLC supported ");
1444 /*******************************************************************
1446 * @brief Pack and send CELL delete response from MAC to DU APP
1450 * Function : packDuMacCellDeleteRsp
1453 * Pack and send CELL delete response from MAC to DU APP
1455 * @params[in] Pst *pst, MacCellDeleteRsp *deleteRsp
1456 * @return ROK - success
1459 * ****************************************************************/
1461 uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp)
1463 Buffer *mBuf = NULLP;
1465 if(pst->selector == ODU_SELECTOR_LWLC)
1467 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1469 DU_LOG("\nERROR --> MAC : packDuMacCellDeleteRsp(): Memory allocation failed ");
1472 CMCHKPK(oduPackPointer,(PTR)cellDeleteRsp, mBuf);
1476 DU_LOG("\nERROR --> MAC: packDuMacCellDeleteRsp(): Only LWLC supported ");
1480 return ODU_POST_TASK(pst,mBuf);
1484 /*******************************************************************
1486 * @brief Unpack cell delete response from MAC to DU APP
1490 * Function : unpackDuMacCellDeleteRsp
1492 * Functionality: Unpack cell delete response from MAC to DU APP
1494 * @params[in] MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf
1495 * @return ROK - success
1498 * ****************************************************************/
1500 uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf)
1502 if(pst->selector == ODU_SELECTOR_LWLC)
1504 MacCellDeleteRsp *cellDeleteRsp = NULLP;
1506 CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDeleteRsp, mBuf);
1507 ODU_PUT_MSG_BUF(mBuf);
1508 return (*func)(pst, cellDeleteRsp);
1512 DU_LOG("\nERROR --> DU APP : unpackDuMacCellDeleteRsp(): Only LWLC supported ");
1513 ODU_PUT_MSG_BUF(mBuf);
1518 /*******************************************************************
1520 * @brief Pack and send Slice Cfg request from MAC to DU APP
1524 * Function : packDuMacSliceCfgReq
1527 * Pack and send Slice Cfg request from MAC to DU APP
1529 * @params[in] Pst *pst, MacSliceCfgReq *sliceCfgReq
1530 * @return ROK - success
1533 * ****************************************************************/
1535 uint8_t packDuMacSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq)
1537 Buffer *mBuf = NULLP;
1539 if(pst->selector == ODU_SELECTOR_LWLC)
1541 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1543 DU_LOG("\nERROR --> MAC : Memory allocation failed in packDuMacSliceCfgReq");
1546 CMCHKPK(oduPackPointer,(PTR)sliceCfgReq, mBuf);
1550 DU_LOG("\nERROR --> MAC: Only LWLC supported in packDuMacSliceCfgReq");
1554 return ODU_POST_TASK(pst,mBuf);
1557 /*******************************************************************
1559 * @brief Unpacks Slice Cfg request received from DU APP
1563 * Function : unpackMacSliceCfgReq
1566 * Unpacks Slice Cfg Request received from DU APP
1568 * @params[in] Pointer to Handler
1569 * Post structure pointer
1571 * @return ROK - success
1574 * ****************************************************************/
1575 uint8_t unpackMacSliceCfgReq(DuMacSliceCfgReq func, Pst *pst, Buffer *mBuf)
1577 if(pst->selector == ODU_SELECTOR_LWLC)
1579 MacSliceCfgReq *sliceCfgReq;
1580 /* unpack the address of the structure */
1581 CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceCfgReq, mBuf);
1582 ODU_PUT_MSG_BUF(mBuf);
1583 return (*func)(pst, sliceCfgReq);
1587 /* Nothing to do for other selectors */
1588 DU_LOG("\nERROR --> DU APP : Only LWLC supported for Slice Cfg Request ");
1589 ODU_PUT_MSG_BUF(mBuf);
1595 /*******************************************************************
1597 * @brief Pack and send Slice config response from MAC to DU APP
1601 * Function : packDuMacSliceCfgRsp
1604 * Pack and send Slice config response from MAC to DU APP
1607 * @return ROK - success
1610 * ****************************************************************/
1611 uint8_t packDuMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp)
1613 Buffer *mBuf = NULLP;
1615 if(pst->selector == ODU_SELECTOR_LWLC)
1617 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1619 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacSliceCfgRsp");
1622 /* pack the address of the structure */
1623 CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
1627 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacSliceCfgRsp");
1631 return ODU_POST_TASK(pst,mBuf);
1634 /*******************************************************************
1636 * @brief Unpack Slice Config Response from MAC to DU APP
1640 * Function :unpackDuMacSliceCfgRsp
1642 * Functionality: Unpack Slice Config Response from MAC to DU APP
1645 * @return ROK - success
1648 * ****************************************************************/
1649 uint8_t unpackDuMacSliceCfgRsp(MacDuSliceCfgRspFunc func, Pst *pst, Buffer *mBuf)
1651 if(pst->selector == ODU_SELECTOR_LWLC)
1653 MacSliceCfgRsp *cfgRsp = NULLP;
1655 /* unpack the address of the structure */
1656 CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
1657 ODU_PUT_MSG_BUF(mBuf);
1658 return (*func)(pst, cfgRsp);
1661 ODU_PUT_MSG_BUF(mBuf);
1666 /*******************************************************************
1668 * @brief Pack and send Slice ReCfg request from MAC to DU APP
1672 * Function : packDuMacSliceRecfgReq
1675 * Pack and send Slice ReCfg request from MAC to DU APP
1677 * @params[in] Pst *pst, MacSliceRecfgReq *sliceRecfgReq
1678 * @return ROK - success
1681 * ****************************************************************/
1683 uint8_t packDuMacSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq)
1685 Buffer *mBuf = NULLP;
1687 if(pst->selector == ODU_SELECTOR_LWLC)
1689 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1691 DU_LOG("\nERROR --> MAC : Memory allocation failed in packDuMacSliceRecfgReq");
1694 CMCHKPK(oduPackPointer,(PTR)sliceRecfgReq, mBuf);
1698 DU_LOG("\nERROR --> MAC: Only LWLC supported in packDuMacSliceRecfgReq");
1702 return ODU_POST_TASK(pst,mBuf);
1705 /*******************************************************************
1707 * @brief Unpacks Slice ReCfg request received from DU APP
1711 * Function : unpackMacSliceCfgReq
1714 * Unpacks Slice ReCfg Request received from DU APP
1716 * @params[in] Pointer to Handler
1717 * Post structure pointer
1719 * @return ROK - success
1722 * ****************************************************************/
1723 uint8_t unpackMacSliceRecfgReq(DuMacSliceRecfgReq func, Pst *pst, Buffer *mBuf)
1725 if(pst->selector == ODU_SELECTOR_LWLC)
1727 MacSliceRecfgReq *sliceRecfgReq;
1728 /* unpack the address of the structure */
1729 CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceRecfgReq, mBuf);
1730 ODU_PUT_MSG_BUF(mBuf);
1731 return (*func)(pst, sliceRecfgReq);
1735 /* Nothing to do for other selectors */
1736 DU_LOG("\nERROR --> DU APP : Only LWLC supported for Slice ReCfg Request ");
1737 ODU_PUT_MSG_BUF(mBuf);
1743 /*******************************************************************
1745 * @brief Pack and send Slice config response from MAC to DU APP
1749 * Function : packDuMacSliceRecfgRsp
1752 * Pack and send Slice config response from MAC to DU APP
1755 * @return ROK - success
1758 * ****************************************************************/
1759 uint8_t packDuMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *sliceRecfgRsp)
1761 Buffer *mBuf = NULLP;
1763 if(pst->selector == ODU_SELECTOR_LWLC)
1765 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1767 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacSliceRecfgRsp");
1770 /* pack the address of the structure */
1771 CMCHKPK(oduPackPointer,(PTR)sliceRecfgRsp, mBuf);
1775 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacSliceRecfgRsp");
1779 return ODU_POST_TASK(pst,mBuf);
1782 /*******************************************************************
1784 * @brief Unpack Slice ReConfig Response from MAC to DU APP
1788 * Function :unpackDuMacSliceRecfgRsp
1790 * Functionality: Unpack Slice ReConfig Response from MAC to DU APP
1793 * @return ROK - success
1796 * ****************************************************************/
1797 uint8_t unpackDuMacSliceRecfgRsp(MacDuSliceRecfgRspFunc func, Pst *pst, Buffer *mBuf)
1799 if(pst->selector == ODU_SELECTOR_LWLC)
1801 MacSliceRecfgRsp *sliceRecfgRsp = NULLP;
1803 /* unpack the address of the structure */
1804 CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceRecfgRsp, mBuf);
1805 ODU_PUT_MSG_BUF(mBuf);
1806 return (*func)(pst, sliceRecfgRsp);
1809 ODU_PUT_MSG_BUF(mBuf);
1813 /*******************************************************************
1815 * @brief Pack and send Slot ind from MAC to DU APP
1819 * Function : packMacSlotInd
1822 * Pack and send Slot ind from MAC to DU APP
1824 * @params[in] Pst *pst, SlotTimingInfo *slotIndInfo
1825 * @return ROK - success
1828 * ****************************************************************/
1829 uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo)
1831 Buffer *mBuf = NULLP;
1833 if(pst->selector == ODU_SELECTOR_LWLC)
1835 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1837 DU_LOG("\nERROR --> MAC : Memory allocation failed at packMacSlotInd");
1840 /* pack the address of the structure */
1841 CMCHKPK(oduPackPointer,(PTR)slotIndInfo, mBuf);
1845 DU_LOG("\nERROR --> MAC: Only LWLC supported for packMacSlotInd");
1849 return ODU_POST_TASK(pst,mBuf);
1852 /*******************************************************************
1854 * @brief Unpack Slot indication from MAC to DU APP
1858 * Function :unpackDuMacSlotInd
1860 * Functionality: Unpack Slot Indication from MAC to DU APP
1862 * @params[in] DuMacSlotInd func, Pst *pst, Buffer *mBuf
1863 * @return ROK - success
1866 * ****************************************************************/
1867 uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
1869 if(pst->selector == ODU_SELECTOR_LWLC)
1871 SlotTimingInfo *slotIndInfo;
1873 /* unpack the address of the structure */
1874 CMCHKUNPK(oduUnpackPointer, (PTR *)&slotIndInfo, mBuf);
1875 ODU_PUT_MSG_BUF(mBuf);
1876 return (*func)(pst, slotIndInfo);
1879 ODU_PUT_MSG_BUF(mBuf);
1883 /*******************************************************************
1885 * @brief Pack and send Dl Pcch indication to MAC
1889 * Function : packDuMacDlPcchInd
1892 * Pack and send Dl Pcch indication to MAC
1894 * @params[in] Post structure
1895 * DlPcchInd *pcchInd;
1896 * @return ROK - success
1899 * ****************************************************************/
1901 uint8_t packDuMacDlPcchInd(Pst *pst, DlPcchInd *pcchInd)
1903 Buffer *mBuf = NULLP;
1905 if(pst->selector == ODU_SELECTOR_LWLC)
1907 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1909 DU_LOG("\nERROR --> MAC : packDuMacDlPcchInd(): Memory allocation failed ");
1912 CMCHKPK(oduPackPointer,(PTR)pcchInd, mBuf);
1913 return ODU_POST_TASK(pst,mBuf);
1917 DU_LOG("\nERROR --> MAC: packDuMacDlPcchInd(): Only LWLC supported ");
1922 /*******************************************************************
1924 * @brief Unpacks downlink pcch indication received from DU APP
1928 * Function : unpackMacDlPcchInd
1931 * Unpacks downlink pcch indication received from DU APP
1933 * @params[in] Pointer to Handler
1934 * Post structure pointer
1936 * @return ROK - success
1939 * ****************************************************************/
1941 uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf)
1943 if(pst->selector == ODU_SELECTOR_LWLC)
1945 DlPcchInd *pcchInd=NULLP;
1947 /* unpack the address of the structure */
1948 CMCHKUNPK(oduUnpackPointer, (PTR *)&pcchInd, mBuf);
1949 ODU_PUT_MSG_BUF(mBuf);
1950 return (*func)(pst, pcchInd);
1954 /* Nothing to do for other selectors */
1955 DU_LOG("\nERROR --> DU APP : unpackMacDlPcchInd(): Only LWLC supported");
1956 ODU_PUT_MSG_BUF(mBuf);
1962 /*******************************************************************
1964 * @brief Packs and Sends UE Reset Request from DUAPP to MAC
1968 * Function : packDuMacUeResetReq
1971 * Packs and Sends UE Reset Request from DUAPP to MAC
1974 * @params[in] Post structure pointer
1975 * MacUeResetReq pointer
1976 * @return ROK - success
1979 * ****************************************************************/
1980 uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueDel)
1982 Buffer *mBuf = NULLP;
1984 if(pst->selector == ODU_SELECTOR_LWLC)
1986 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1988 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeResetReq");
1991 /* pack the address of the structure */
1992 CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
1996 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeResetReq");
1999 return ODU_POST_TASK(pst,mBuf);
2002 /*******************************************************************
2004 * @brief Unpacks UE Reset Request received from DU APP
2008 * Function : unpackMacUeResetReq
2011 * Unpacks UE Reset Request received from DU APP
2013 * @params[in] Pointer to Handler
2014 * Post structure pointer
2016 * @return ROK - success
2019 * ****************************************************************/
2020 uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf)
2022 if(pst->selector == ODU_SELECTOR_LWLC)
2024 MacUeResetReq *ueReset;
2026 /* unpack the address of the structure */
2027 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueReset, mBuf);
2028 ODU_PUT_MSG_BUF(mBuf);
2029 return (*func)(pst, ueReset);
2033 /* Nothing to do for other selectors */
2034 DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Reset Request ");
2035 ODU_PUT_MSG_BUF(mBuf);
2041 /*******************************************************************
2043 * @brief Pack and send UE reset response from MAC to DU APP
2047 * Function : packDuMacUeResetRsp
2050 * Pack and send UE reset response from MAC to DU APP
2053 * @return ROK - success
2056 * ****************************************************************/
2057 uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp)
2059 Buffer *mBuf = NULLP;
2061 if(pst->selector == ODU_SELECTOR_LWLC)
2063 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2065 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeResetRsp");
2068 /* pack the address of the structure */
2069 CMCHKPK(oduPackPointer,(PTR)resetRsp, mBuf);
2073 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeResetRsp");
2077 return ODU_POST_TASK(pst,mBuf);
2080 /*******************************************************************
2082 * @brief Unpack UE Config Response from MAC to DU APP
2086 * Function :unpackDuMacUeResetRsp
2088 * Functionality: Unpack UE Config Response from MAC to DU APP
2091 * @return ROK - success
2094 * ****************************************************************/
2095 uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf)
2097 if(pst->selector == ODU_SELECTOR_LWLC)
2099 MacUeResetRsp *ueResetRsp = NULLP;
2101 /* unpack the address of the structure */
2102 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueResetRsp, mBuf);
2103 ODU_PUT_MSG_BUF(mBuf);
2104 return (*func)(pst, ueResetRsp);
2107 ODU_PUT_MSG_BUF(mBuf);
2111 /*******************************************************************
2113 * @brief Pack and send UE Sync Status Indication from MAC to DU APP
2117 * Function : packDuMacUeSyncStatusInd
2120 * Pack and send UE Sync Status Indication from MAC to DU APP
2123 * @return ROK - success
2126 * ****************************************************************/
2127 uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *SyncStatusInd)
2129 Buffer *mBuf = NULLP;
2131 if(pst->selector == ODU_SELECTOR_LWLC)
2133 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2135 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeSyncStatusInd");
2138 /* pack the address of the structure */
2139 CMCHKPK(oduPackPointer,(PTR)SyncStatusInd, mBuf);
2143 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeSyncStatusInd");
2147 return ODU_POST_TASK(pst,mBuf);
2150 /*******************************************************************
2152 * @brief Unpack UE Config Response from MAC to DU APP
2156 * Function :unpackDuMacUeSyncStatusInd
2158 * Functionality: Unpack UE Config Response from MAC to DU APP
2161 * @return ROK - success
2164 * ****************************************************************/
2165 uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf)
2167 if(pst->selector == ODU_SELECTOR_LWLC)
2169 MacUeSyncStatusInd *ueSyncStatusInd = NULLP;
2171 /* unpack the address of the structure */
2172 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueSyncStatusInd, mBuf);
2173 ODU_PUT_MSG_BUF(mBuf);
2174 return (*func)(pst, ueSyncStatusInd);
2177 ODU_PUT_MSG_BUF(mBuf);
2181 /*******************************************************************
2183 * @brief Packs and Sends Dl Broadcast Request from DUAPP to MAC
2187 * Function : packDuMacDlBroadcastReq
2190 * Packs and Sends Dl Broadcast Request from DUAPP to MAC
2193 * @params[in] Post structure pointer
2194 * MacDlBroadcastReq pointer
2195 * @return ROK - success
2198 * ****************************************************************/
2199 uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *ueDel)
2201 Buffer *mBuf = NULLP;
2203 if(pst->selector == ODU_SELECTOR_LWLC)
2205 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2207 DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacDlBroadcastReq");
2210 /* pack the address of the structure */
2211 CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
2215 DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacDlBroadcastReq");
2218 return ODU_POST_TASK(pst,mBuf);
2221 /*******************************************************************
2223 * @brief Unpacks Dl Broadcast Request received from DU APP
2227 * Function : unpackMacDlBroadcastReq
2230 * Unpacks Dl Broadcast Request received from DU APP
2232 * @params[in] Pointer to Handler
2233 * Post structure pointer
2235 * @return ROK - success
2238 * ****************************************************************/
2239 uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf)
2241 if(pst->selector == ODU_SELECTOR_LWLC)
2243 MacDlBroadcastReq *dlBroadcast;
2245 /* unpack the address of the structure */
2246 CMCHKUNPK(oduUnpackPointer, (PTR *)&dlBroadcast, mBuf);
2247 ODU_PUT_MSG_BUF(mBuf);
2248 return (*func)(pst, dlBroadcast);
2252 /* Nothing to do for other selectors */
2253 DU_LOG("\nERROR --> DU APP : Only LWLC supported for Dl Broadcast Request ");
2254 ODU_PUT_MSG_BUF(mBuf);
2259 /*******************************************************************
2261 * @brief Searches for first unset bit in ueBitMap
2265 * Function : getFreeBitFromUeBitMap
2267 * Functionality: Searches for first unset bit in ueBitMap of
2268 * a cell. Search starts from LSB to MSB. Returns index of the
2269 * free bit, considering LSB at index 0 and increasing index
2272 * @params[in] Cell Id
2273 * @return Index of free bit - success
2276 * ****************************************************************/
2277 int8_t getFreeBitFromUeBitMap(uint16_t cellId)
2279 uint8_t bitIdx = 0; /* bit position */
2280 uint16_t cellIdx = 0; /* Index to acces ueBitMapPerCell[] */
2281 uint64_t mask = 1; /* bit mask */
2283 GET_CELL_IDX(cellId, cellIdx);
2286 /* Find the first unset bit in Bit Map */
2287 if((ueBitMapPerCell[cellIdx] & (mask << bitIdx)) == 0)
2289 SET_ONE_BIT(bitIdx, ueBitMapPerCell[cellIdx]);
2298 /*******************************************************************
2300 * @brief Unset a previously set bit in UeBitMap
2304 * Function : unsetBitInUeBitMap
2306 * Functionality: Searches for bit at given index and unset it.
2308 * @params[in] Cell Id
2312 * ****************************************************************/
2313 void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos)
2317 GET_CELL_IDX(cellId, cellIdx);
2318 UNSET_ONE_BIT(bitPos, ueBitMapPerCell[cellIdx]);
2321 /**********************************************************************
2323 **********************************************************************/