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 /************************************************************************
25 Desc: C source code for Entry point fucntions
29 **********************************************************************/
32 @brief This module acts as an interface handler for upper interface and
33 manages Pst and Sap related information for upper interface APIs.
37 /* header include files -- defines (.h) */
39 /* header/extern include files (.x) */
40 /* header include files (.h) */
41 #include "common_def.h"
42 #include "crg.h" /* CRG defines */
43 #include "lrg.h" /* layer management defines for LTE-MAC */
46 #include "rg_sch_inf.h"
47 #include "rg_env.h" /* customizable defines and macros for MAC */
48 #include "rg.h" /* defines and macros for MAC */
49 #include "rg_err.h" /* RG error defines */
51 /* header/extern include files (.x) */
53 #include "crg.x" /* CRG types */
54 #include "lrg.x" /* layer management typedefs for MAC */
57 #include "rg_sch_inf.x"
58 #include "rg_prg.x" /* PRG interface typedefs*/
59 #include "du_app_mac_inf.h"
60 #include "rg.x" /* typedefs for MAC */
71 /* forward references */
73 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
74 S16 rgBatchProc(Void);
79 * @brief Handler for Bind request.
83 * Function : RgUiRguBndReq
85 * This function handles the bind request from MAC Service User.
89 * @param[in] SuId suId
90 * @param[in] SpId spId
104 Pst tmpPst; /* Temporary Post Structure */
105 RgUstaDgn dgn; /* Alarm diagnostics structure */
107 RG_IS_INST_VALID(pst->dstInst);
108 inst = pst->dstInst - RG_INST_START;
110 tmpPst.prior = pst->prior;
111 tmpPst.route = pst->route;
112 tmpPst.selector = pst->selector;
113 tmpPst.region = rgCb[inst].rgInit.region;
114 tmpPst.pool = rgCb[inst].rgInit.pool;
115 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
116 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
117 tmpPst.srcInst = rgCb[inst].rgInit.inst;
118 tmpPst.event = EVTNONE;
119 tmpPst.dstProcId = pst->srcProcId;
120 tmpPst.dstEnt = pst->srcEnt;
121 tmpPst.dstInst = pst->srcInst;
123 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
125 /* Check the state of the SAP */
126 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
128 case LRG_NOT_CFG: /* SAP Not configured */
129 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
130 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
131 LCM_CAUSE_INV_SAP, &dgn);
132 DU_LOG("\nDEBUG --> MAC : SAP Not Configured");
133 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
135 case LRG_UNBND: /* SAP is not bound */
136 DU_LOG("\nDEBUG --> MAC : SAP Not yet bound");
137 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
138 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
139 /* Send Bind Confirm with status as SUCCESS */
140 /*T2K - Passing spId as it is required to access the SAP CB*/
141 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
142 /* Indicate to Layer manager */
143 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
144 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
145 LCM_CAUSE_UNKNOWN, &dgn);
147 case LRG_BND: /* SAP is already bound*/
148 DU_LOG("\nDEBUG --> MAC : SAP already bound");
149 /*T2K - Passing spId as it is required to access the SAP CB*/
150 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
152 default: /* Should Never Enter here */
153 #if (ERRCLASS & ERRCLS_ADD_RES)
154 DU_LOG("\nERROR --> MAC : Invalid SAP State:RgUiRguBndReq failed\n");
156 /*T2K - Passing spId as it is required to access the SAP CB*/
157 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
163 #if (ERRCLASS & ERRCLS_ADD_RES)
164 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguBndReq failed\n");
166 /*T2K - Passing spId as it is required to access the SAP CB*/
167 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
170 } /* RgUiRguBndReq */
174 * @brief Handler for Unbind request.
178 * Function : RgUiRguUbndReq
180 * This function handles the unbind request from MAC Service User.
183 * @param[in] Pst *pst
184 * @param[in] SpId spId
185 * @param[in] Reason reason
199 RG_IS_INST_VALID(pst->dstInst);
200 inst = pst->dstInst - RG_INST_START;
201 /* SAP Id validation */
202 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
204 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
206 case LRG_BND: /* SAP is already bound*/
207 DU_LOG("\nDEBUG --> MAC : SAP already bound");
208 /* setting SAP state to UN BOUND */
209 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
212 #if (ERRCLASS & ERRCLS_ADD_RES)
213 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguUbndReq failed",
214 rgCb[inst].rguSap[spId].sapSta.sapState);
222 #if (ERRCLASS & ERRCLS_ADD_RES)
223 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguUbndReq failed\n");
228 } /* RgUiRguUbndReq */
230 * @brief API for sending bind confirm from MAC to RLC
234 * Function: rgUIMRguBndCfm
236 * This API is invoked to send bind confirm from MAC to RLC.
237 * This API fills in Pst structure and SAP Ids and invokes
238 * bind confirm API towards RLC.
240 * @param[in] Inst inst
241 * @param[in] SuId suId
242 * @param[in] uint8_t status
247 S16 rgUIMRguBndCfm(Inst inst,SpId spId,uint8_t status)
251 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
252 rgCb[inst].rguSap[spId].sapCfg.suId, status);
256 DU_LOG("\nERROR --> MAC : RgUiRguBndCfm Failed ");
260 } /* rgUIMRguBndCfm*/
264 * @brief Handler for dedicated DatReq from RGU
268 * Function : RgUiRguDDatReq
270 * This function validates SAP and invokes ROM for further processing
272 * @param[in] Pst *pst
273 * @param[in] SpId spId
274 * @param[in] RguDDatReqInfo *datReq
279 S16 RgUiRguDDatReq(Pst *pst,SpId spId,RguDDatReqInfo *datReq)
290 RG_IS_INST_VALID(pst->dstInst);
291 inst = pst->dstInst - RG_INST_START;
295 DU_LOG("\nERROR --> MAC : Input Message Buffer is NULL");
299 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
301 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
303 case LRG_BND: /* SAP is bound */
304 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
306 default: /* Should never reach here */
307 #if (ERRCLASS & ERRCLS_ADD_RES)
308 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguDDatReq failed",
309 rgCb[inst].rguSap[spId].sapSta.sapState);
312 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
314 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
322 #if (ERRCLASS & ERRCLS_ADD_RES)
323 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguDDatReq failed\n");
326 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
328 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
334 /* Update RGU SAP statistics for received sdu count */
335 /*ccpu00118201 - ADD - Send trace only when its enabled*/
336 if(rgCb[inst].rgInit.trc)
338 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
340 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
341 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
343 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
345 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
346 * rgROMDedDatReq -> rgUpdtRguDedSts function
347 * So numPduRcvd updation is commented here */
348 /* rgCb.rguSap.sapSts.numPduRcvd +=
349 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
350 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
352 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
353 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
361 /* Call Ownership module for further processing */
362 ret = rgROMDedDatReq(inst,datReq);
363 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
366 } /* RgUiRguDDatReq */
370 * @brief Handler for common DatReq from RGU
374 * Function : RgUiRguCDatReq
376 * This function validates SAP invokes ROM for further processing
378 * @param[in] Pst *pst
379 * @param[in] SpId spId
380 * @param[in] RguCDatReqInfo *datReq
389 RguCDatReqInfo *datReq
395 RG_IS_INST_VALID(pst->dstInst);
396 inst = pst->dstInst - RG_INST_START;
400 DU_LOG("\nERROR --> MAC : Input Message Buffer is NULL");
404 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
406 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
408 case LRG_BND: /* SAP is bound */
409 DU_LOG("\nERROR --> MAC : SAP is already bound");
411 default: /* Should never reach here */
412 #if (ERRCLASS & ERRCLS_ADD_RES)
413 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguCDatReq failed",
414 rgCb[inst].rguSap[spId].sapSta.sapState);
421 #if (ERRCLASS & ERRCLS_ADD_RES)
422 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
428 /* Update RGU SAP statistics for received sdu count */
429 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
430 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
431 * So numPduRcvd updation is commented here */
432 /* rgCb.rguSap.sapSts.numPduRcvd++; */
434 ret = rgROMCmnDatReq(inst,datReq);
435 /*ccpu00118201 - ADD - Send trace only when its enabled*/
436 if(rgCb[inst].rgInit.trc)
438 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
442 RG_DROP_RGUCDATREQ_MBUF(datReq);
444 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
447 } /* RgUiRguCDatReq */
451 * @brief Handler for dedicated StaRsp from RGU
455 * Function : RgUiRguDStaRsp
457 * This function validates SAP and invokes ROM for further processing
459 * @param[in] Pst *pst
460 * @param[in] SpId spId
461 * @param[in] RguDStaRspInfo *staRsp
470 RguDStaRspInfo *staRsp
475 volatile uint32_t startTime = 0;
478 RG_IS_INST_VALID(pst->dstInst);
479 inst = pst->dstInst - RG_INST_START;
481 SStartTask(&startTime, PID_MAC_STA_RSP);
483 ret = rgROMDedStaRsp(inst,staRsp);
486 DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
491 SStopTask(startTime, PID_MAC_STA_RSP);
493 } /* RgUiRguDStaRsp */
497 * @brief Handler for common StaRsp from RGU
501 * Function : RgUiRguCStaRsp
503 * This function validates SAP and invokes ROM
504 * for further processing
507 * @param[in] Pst *pst
508 * @param[in] SpId spId
509 * @param[in] RguCStaRspInfo *staRsp
518 RguCStaRspInfo *staRsp
524 RG_IS_INST_VALID(pst->dstInst);
525 inst = pst->dstInst - RG_INST_START;
529 DU_LOG("\nERROR --> MAC : Input Response Buffer is NULL");
533 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
535 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
537 case LRG_BND: /* SAP is bound */
538 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
540 default: /* Should never reach here */
541 #if (ERRCLASS & ERRCLS_ADD_RES)
542 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguCStaRsp failed",
543 rgCb[inst].rguSap[spId].sapSta.sapState);
550 #if (ERRCLASS & ERRCLS_ADD_RES)
551 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
557 ret = rgROMCmnStaRsp(inst,staRsp);
560 DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
564 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
567 } /* RgUiRguCStaRsp */
572 * @brief Handler for L2M MeasReq from RGU
576 * Function :RgUiRguL2MUlThrpMeasReq
578 * This function validates SAP and invokes ROM for further processing
580 * @param[in] Pst *pst
581 * @param[in] SpId spId
582 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
587 S16 RgUiRguL2MUlThrpMeasReq
591 RguL2MUlThrpMeasReqInfo *measReq
598 RG_IS_INST_VALID(pst->dstInst);
599 inst = pst->dstInst - RG_INST_START;
601 if (measReq == NULLP)
603 DU_LOG("\nERROR --> MAC : Input Response Buffer is NULL");
607 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
609 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
611 case LRG_BND: /* SAP is bound */
612 DU_LOG("\nERROR --> MAC : SAP is already bound");
614 default: /* Should never reach here */
615 #if (ERRCLASS & ERRCLS_ADD_RES)
616 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
617 rgCb[inst].rguSap[spId].sapSta.sapState);
624 #if (ERRCLASS & ERRCLS_ADD_RES)
625 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
631 ret = rgROML2MUlThrpMeasReq(inst,measReq);
634 DU_LOG("\nERROR --> MAC : Processing Of Meas Request Failed");
637 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
640 } /* RgUiRguL2MUlThrpMeasReq */
644 * @brief Handler for sending staInd to dedicated logical channels of a UE
648 * Function : rgUIMSndDedStaInd
650 * This function fills SAP and Pst information to send the staInd to
654 * @param[in] Inst inst
655 * @param[in] RgUpSapCb *rguSap
656 * @param[in] RgRguDedStaInd *staInd
661 S16 rgUIMSndDedStaInd
665 RgRguDedStaInd *staInd
670 DU_LOG("\nINFO --> MAC : rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd);
672 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
676 DU_LOG("\nERROR --> MAC : RgUiRguDStaInd Failed");
680 } /* rgUIMSndDedStaInd */
684 * @brief Handler for sending staInd to a common logical channel.
688 * Function : rgUIMSndCmnStaInd
690 * This function fills SAP and Pst information to send the staInd to
691 * a common logical channel.
694 * @param[in] Inst inst
695 * @param[in] RgUpSapCb *rguSap
696 * @param[in] RgRguCmnStaInd *staInd
701 S16 rgUIMSndCmnStaInd
705 RgRguCmnStaInd *staInd
710 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
714 DU_LOG("\nERROR --> MAC : RgUiRguCStaInd Failed");
718 } /* rgUIMSndCmnStaInd */
722 * @brief Handler for sending datInd to dedicated logical channels of a UE
726 * Function : rgUIMSndDedDatInd
728 * This function fills SAP and Pst information to send the datInd to
732 * @param[in] Inst inst
733 * @param[in] RgUpSapCb *rguUlSap
734 * @param[in] RgRguDedDatInd *datInd
739 S16 rgUIMSndDedDatInd
743 RgRguDedDatInd *datInd
748 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
750 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
754 DU_LOG("\nERROR --> MAC : RgUiRguDdatInd Failed");
758 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
759 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
762 } /* rgUIMSndDedDatInd */
766 * @brief Handler for sending datInd to a common logical channel.
770 * Function : rgUIMSndCmnDatInd
772 * This function fills SAP and Pst information to send the datInd to
773 * a common logical channel.
776 * @param[in] Inst inst
777 * @param[in] RgUpSapCb *rguSap
778 * @param[in] RgRguCmnDatInd *datInd
783 S16 rgUIMSndCmnDatInd(Inst inst,RgUpSapCb *rguUlSap,RgRguCmnDatInd *datInd)
787 DU_LOG("\nDEBUG --> MAC : rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd);
789 rguUlSap->sapSts.numPduTxmit++;
791 DU_LOG("\nDEBUG --> MAC : rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId);
792 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
796 DU_LOG("\nERROR --> MAC : RgUiRguCDatInd Failed");
800 } /* rgUIMSndCmnDatInd */
804 * @brief API for bind request from RRC towards MAC.
808 * Function: RgUiCrgBndReq
810 * This API is invoked by RRC towards MAC to bind CRG SAP.
811 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
814 * @param[in] Pst *pst
815 * @param[in] SuId suId
816 * @param[in] SpId spId
821 S16 RgUiCrgBndReq(Pst *pst, SuId suId,SpId spId)
824 Pst tmpPst; /* Temporary Post Structure */
825 RgUstaDgn dgn; /* Alarm diagnostics structure */
828 RG_IS_INST_VALID(pst->dstInst);
829 inst = pst->dstInst - RG_INST_START;
831 tmpPst.prior = pst->prior;
832 tmpPst.route = pst->route;
833 tmpPst.selector = pst->selector;
834 tmpPst.region = rgCb[inst].rgInit.region;
835 tmpPst.pool = rgCb[inst].rgInit.pool;
836 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
837 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
838 tmpPst.srcInst = rgCb[inst].rgInit.inst;
839 tmpPst.event = EVTNONE;
840 tmpPst.dstProcId = pst->srcProcId;
841 tmpPst.dstEnt = pst->srcEnt;
842 tmpPst.dstInst = pst->srcInst;
845 if(spId == rgCb[inst].crgSap.sapCfg.spId)
847 /* Check the state of the SAP */
848 switch (rgCb[inst].crgSap.sapSta.sapState)
850 case LRG_NOT_CFG: /* SAP Not configured */
852 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
853 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
854 LCM_CAUSE_INV_SAP, &dgn);
855 DU_LOG("\nDEBUG --> MAC : SAP Not Configured");
856 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
858 case LRG_UNBND: /* SAP is not bound */
859 DU_LOG("\nERROR --> MAC : SAP Not yet bound");
861 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
862 rgCb[inst].crgSap.sapCfg.suId = suId;
863 /* Send Bind Confirm with status as SUCCESS */
864 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
865 /* Indicate to Layer manager */
866 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
867 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
868 LCM_CAUSE_UNKNOWN, &dgn);
870 case LRG_BND: /* SAP is already bound*/
871 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
873 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
875 default: /* Should Never Enter here */
876 #if (ERRCLASS & ERRCLS_ADD_RES)
877 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgBndReq failed",
878 rgCb[inst].crgSap.sapSta.sapState);
880 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
886 #if (ERRCLASS & ERRCLS_ADD_RES)
887 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgBndReq failed",
888 rgCb[inst].crgSap.sapCfg.spId);
890 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
893 } /* RgUiCrgBndReq */
897 * @brief API for unbind request from RRC towards MAC.
901 * Function: RgUiCrgUbndReq
903 * This API is invoked by RRC towards MAC to unbind CRG SAP.
904 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
907 * @param[in] Pst *pst
908 * @param[in] SuId suId
909 * @param[in] Reason reason
914 S16 RgUiCrgUbndReq(Pst *pst,SpId spId,Reason reason)
918 RG_IS_INST_VALID(pst->dstInst);
919 inst = pst->dstInst - RG_INST_START;
920 /* SAP Id validation */
921 if (spId == rgCb[inst].crgSap.sapCfg.spId)
923 switch(rgCb[inst].crgSap.sapSta.sapState)
925 case LRG_BND: /* SAP is already bound*/
926 /* setting SAP state to UN BOUND */
927 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
929 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
932 #if (ERRCLASS & ERRCLS_ADD_RES)
933 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgUbndReq failed",
934 rgCb[inst].crgSap.sapSta.sapState);
941 #if (ERRCLASS & ERRCLS_ADD_RES)
942 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgUbndReq failed",
943 rgCb[inst].crgSap.sapCfg.spId);
948 } /* RgUiCrgUbndReq */
951 * @brief API for sending bind confirm from MAC to RRC
955 * Function: rgUIMRgrBndCfm
957 * This API is invoked to send bind confirm from MAC to RRC.
958 * This API fills in Pst structure and SAP Ids and invokes
959 * bind confirm API towards RRC.
961 * @param[in] Inst inst
962 * @param[in] SuId suId
963 * @param[in] uint8_t status
968 S16 rgUIMCrgBndCfm(Inst inst,SuId suId,uint8_t status)
971 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
973 DU_LOG("\nERROR --> MAC : RgUiCrgBndCfm Failed ");
978 } /* rgUIMCrgBndCfm*/
981 * @brief API for configuration request from RRC towards MAC.
985 * Function: RgUiCrgCfgReq
987 * This API is invoked by RRC towards MAC to configure MAC.
988 * These API validates the Pst, spId, suId and transfers the config request
989 * specific information to corresponding ownership module (COM) API.
992 * @param[in] Pst *pst
993 * @param[in] SpId spId
994 * @param[in] CrgCfgTransId transId
995 * @param[in] CrgCfgReqInfo *cfgReqInfo
1004 CrgCfgTransId transId,
1005 CrgCfgReqInfo *cfgReqInfo
1010 uint8_t cfmStatus = 0x00ff;
1011 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1013 RG_IS_INST_VALID(pst->dstInst);
1014 inst = pst->dstInst - RG_INST_START;
1015 /* Ensuring transId is always Null terminated. */
1016 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1017 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1020 /* CrgCfgReqInfo Validation for NULLP */
1021 if (cfgReqInfo == NULLP)
1023 DU_LOG("\nERROR --> MAC : Input Param crgReqInfo is NULL ");
1024 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1028 /* Upper SAP Id and State validation */
1029 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1031 switch(rgCb[inst].crgSap.sapSta.sapState)
1033 case LRG_BND: /* SAP is already bound */
1034 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
1036 default: /* Should never reach here */
1037 #if (ERRCLASS & ERRCLS_ADD_RES)
1038 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgCfgReq failed",
1039 rgCb[inst].crgSap.sapSta.sapState);
1041 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1042 sizeof(CrgCfgReqInfo));
1045 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1051 #if (ERRCLASS & ERRCLS_ADD_RES)
1052 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgCfgReq failed",
1053 rgCb[inst].crgSap.sapCfg.spId);
1055 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1056 sizeof(CrgCfgReqInfo));
1058 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1061 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1062 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1063 sizeof(CrgCfgReqInfo));
1067 DU_LOG("\nERROR --> MAC : Configuration Request Handling Failed ");
1072 } /* RgUiCrgCfgReq */
1075 * @brief API for sending configuration confirm from MAC to RRC
1079 * Function: rgUIMCrgCfgCfm
1081 * This API is invoked to send configuration confirm from MAC to RRC.
1082 * This API fills in Pst structure and SAP Ids and invokes
1083 * config confirm API towards RRC.
1085 * @param[in] Inst inst
1086 * @param[in] CrgCfgTransId transId
1087 * @param[in] uint8_t status
1095 CrgCfgTransId transId,
1100 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1102 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1103 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1106 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1109 DU_LOG("\nERROR --> MAC : RgUiCrgCfgCfm Failed ");
1114 } /* rgUIMCrgCfgCfm */
1115 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1117 S16 rgBatchProc(Void)
1119 /* Read from Ring Buffer and process RLC BO Update */
1122 RguDStaRspInfo *staRsp;
1123 uint32_t elmIndx = 0;
1128 pst.dstEnt = ENTMAC;
1130 pst.srcEnt = ENTRLC;
1133 pst.route = RTESPEC;
1134 pst.event = EVTRGUDSTARSP;
1137 pst.selector = 2; /*SM_SELECTOR_LC */
1141 elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1142 while(NULLP != elmIndx)
1144 staRsp = (RguDStaRspInfo *)elmIndx;
1148 RgUiRguDStaRsp(&pst, spId, staRsp);
1152 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1154 if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1161 /**********************************************************************
1164 **********************************************************************/