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 */
50 #include "mac_utils.h"
52 /* header/extern include files (.x) */
54 #include "crg.x" /* CRG types */
55 #include "lrg.x" /* layer management typedefs for MAC */
58 #include "rg_sch_inf.x"
59 #include "rg_prg.x" /* PRG interface typedefs*/
60 #include "du_app_mac_inf.h"
61 #include "rg.x" /* typedefs for MAC */
72 /* forward references */
74 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
75 S16 rgBatchProc(Void);
80 * @brief Handler for Bind request.
84 * Function : RgUiRguBndReq
86 * This function handles the bind request from MAC Service User.
90 * @param[in] SuId suId
91 * @param[in] SpId spId
105 Pst tmpPst; /* Temporary Post Structure */
106 RgUstaDgn dgn; /* Alarm diagnostics structure */
108 RG_IS_INST_VALID(pst->dstInst);
109 inst = pst->dstInst - RG_INST_START;
111 tmpPst.prior = pst->prior;
112 tmpPst.route = pst->route;
113 tmpPst.selector = pst->selector;
114 tmpPst.region = rgCb[inst].rgInit.region;
115 tmpPst.pool = rgCb[inst].rgInit.pool;
116 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
117 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
118 tmpPst.srcInst = rgCb[inst].rgInit.inst;
119 tmpPst.event = EVTNONE;
120 tmpPst.dstProcId = pst->srcProcId;
121 tmpPst.dstEnt = pst->srcEnt;
122 tmpPst.dstInst = pst->srcInst;
124 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
126 /* Check the state of the SAP */
127 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
129 case LRG_NOT_CFG: /* SAP Not configured */
130 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
131 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
132 LCM_CAUSE_INV_SAP, &dgn);
133 DU_LOG("\nDEBUG --> MAC : SAP Not Configured");
134 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
136 case LRG_UNBND: /* SAP is not bound */
137 DU_LOG("\nDEBUG --> MAC : SAP Not yet bound");
138 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
139 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
140 /* Send Bind Confirm with status as SUCCESS */
141 /*T2K - Passing spId as it is required to access the SAP CB*/
142 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
143 /* Indicate to Layer manager */
144 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
145 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
146 LCM_CAUSE_UNKNOWN, &dgn);
148 case LRG_BND: /* SAP is already bound*/
149 DU_LOG("\nDEBUG --> MAC : SAP already bound");
150 /*T2K - Passing spId as it is required to access the SAP CB*/
151 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
153 default: /* Should Never Enter here */
154 #if (ERRCLASS & ERRCLS_ADD_RES)
155 DU_LOG("\nERROR --> MAC : Invalid SAP State:RgUiRguBndReq failed\n");
157 /*T2K - Passing spId as it is required to access the SAP CB*/
158 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
164 #if (ERRCLASS & ERRCLS_ADD_RES)
165 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguBndReq failed\n");
167 /*T2K - Passing spId as it is required to access the SAP CB*/
168 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
171 } /* RgUiRguBndReq */
175 * @brief Handler for Unbind request.
179 * Function : RgUiRguUbndReq
181 * This function handles the unbind request from MAC Service User.
184 * @param[in] Pst *pst
185 * @param[in] SpId spId
186 * @param[in] Reason reason
200 RG_IS_INST_VALID(pst->dstInst);
201 inst = pst->dstInst - RG_INST_START;
202 /* SAP Id validation */
203 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
205 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
207 case LRG_BND: /* SAP is already bound*/
208 DU_LOG("\nDEBUG --> MAC : SAP already bound");
209 /* setting SAP state to UN BOUND */
210 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
213 #if (ERRCLASS & ERRCLS_ADD_RES)
214 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguUbndReq failed",
215 rgCb[inst].rguSap[spId].sapSta.sapState);
223 #if (ERRCLASS & ERRCLS_ADD_RES)
224 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguUbndReq failed\n");
229 } /* RgUiRguUbndReq */
231 * @brief API for sending bind confirm from MAC to RLC
235 * Function: rgUIMRguBndCfm
237 * This API is invoked to send bind confirm from MAC to RLC.
238 * This API fills in Pst structure and SAP Ids and invokes
239 * bind confirm API towards RLC.
241 * @param[in] Inst inst
242 * @param[in] SuId suId
243 * @param[in] uint8_t status
248 S16 rgUIMRguBndCfm(Inst inst,SpId spId,uint8_t status)
252 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
253 rgCb[inst].rguSap[spId].sapCfg.suId, status);
257 DU_LOG("\nERROR --> MAC : RgUiRguBndCfm Failed ");
261 } /* rgUIMRguBndCfm*/
265 * @brief Handler for dedicated DatReq from RGU
269 * Function : RgUiRguDDatReq
271 * This function validates SAP and invokes ROM for further processing
273 * @param[in] Pst *pst
274 * @param[in] SpId spId
275 * @param[in] RguDDatReqInfo *datReq
280 S16 RgUiRguDDatReq(Pst *pst,SpId spId,RguDDatReqInfo *datReq)
291 RG_IS_INST_VALID(pst->dstInst);
292 inst = pst->dstInst - RG_INST_START;
296 DU_LOG("\nERROR --> MAC : Input Message Buffer is NULL");
300 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
302 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
304 case LRG_BND: /* SAP is bound */
305 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
307 default: /* Should never reach here */
308 #if (ERRCLASS & ERRCLS_ADD_RES)
309 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguDDatReq failed",
310 rgCb[inst].rguSap[spId].sapSta.sapState);
313 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
315 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
323 #if (ERRCLASS & ERRCLS_ADD_RES)
324 DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguDDatReq failed\n");
327 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
329 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
335 /* Update RGU SAP statistics for received sdu count */
336 /*ccpu00118201 - ADD - Send trace only when its enabled*/
337 if(rgCb[inst].rgInit.trc)
339 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
341 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
342 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
344 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
346 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
347 * rgROMDedDatReq -> rgUpdtRguDedSts function
348 * So numPduRcvd updation is commented here */
349 /* rgCb.rguSap.sapSts.numPduRcvd +=
350 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
351 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
353 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
354 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
362 /* Call Ownership module for further processing */
363 ret = rgROMDedDatReq(inst,datReq);
364 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, datReq,sizeof(RguDDatReqInfo));
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 MAC_FREE_SHRABL_BUF(pst->region, pst->pool,datReq,sizeof(RguCDatReqInfo));
446 } /* RgUiRguCDatReq */
450 * @brief Handler for dedicated StaRsp from RGU
454 * Function : RgUiRguDStaRsp
456 * This function validates SAP and invokes ROM for further processing
458 * @param[in] Pst *pst
459 * @param[in] SpId spId
460 * @param[in] RguDStaRspInfo *staRsp
469 RguDStaRspInfo *staRsp
474 volatile uint32_t startTime = 0;
477 RG_IS_INST_VALID(pst->dstInst);
478 inst = pst->dstInst - RG_INST_START;
480 SStartTask(&startTime, PID_MAC_STA_RSP);
482 ret = rgROMDedStaRsp(inst,staRsp);
485 DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
490 SStopTask(startTime, PID_MAC_STA_RSP);
492 } /* RgUiRguDStaRsp */
496 * @brief Handler for common StaRsp from RGU
500 * Function : RgUiRguCStaRsp
502 * This function validates SAP and invokes ROM
503 * for further processing
506 * @param[in] Pst *pst
507 * @param[in] SpId spId
508 * @param[in] RguCStaRspInfo *staRsp
517 RguCStaRspInfo *staRsp
523 RG_IS_INST_VALID(pst->dstInst);
524 inst = pst->dstInst - RG_INST_START;
528 DU_LOG("\nERROR --> MAC : Input Response Buffer is NULL");
532 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
534 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
536 case LRG_BND: /* SAP is bound */
537 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
539 default: /* Should never reach here */
540 #if (ERRCLASS & ERRCLS_ADD_RES)
541 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguCStaRsp failed",
542 rgCb[inst].rguSap[spId].sapSta.sapState);
549 #if (ERRCLASS & ERRCLS_ADD_RES)
550 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
556 ret = rgROMCmnStaRsp(inst,staRsp);
559 DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
563 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, staRsp,sizeof(RguCStaRspInfo));
565 } /* RgUiRguCStaRsp */
570 * @brief Handler for L2M MeasReq from RGU
574 * Function :RgUiRguL2MUlThrpMeasReq
576 * This function validates SAP and invokes ROM for further processing
578 * @param[in] Pst *pst
579 * @param[in] SpId spId
580 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
585 S16 RgUiRguL2MUlThrpMeasReq
589 RguL2MUlThrpMeasReqInfo *measReq
596 RG_IS_INST_VALID(pst->dstInst);
597 inst = pst->dstInst - RG_INST_START;
599 if (measReq == NULLP)
601 DU_LOG("\nERROR --> MAC : Input Response Buffer is NULL");
605 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
607 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
609 case LRG_BND: /* SAP is bound */
610 DU_LOG("\nERROR --> MAC : SAP is already bound");
612 default: /* Should never reach here */
613 #if (ERRCLASS & ERRCLS_ADD_RES)
614 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
615 rgCb[inst].rguSap[spId].sapSta.sapState);
622 #if (ERRCLASS & ERRCLS_ADD_RES)
623 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
629 ret = rgROML2MUlThrpMeasReq(inst,measReq);
632 DU_LOG("\nERROR --> MAC : Processing Of Meas Request Failed");
635 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo));
637 } /* RgUiRguL2MUlThrpMeasReq */
641 * @brief Handler for sending staInd to dedicated logical channels of a UE
645 * Function : rgUIMSndDedStaInd
647 * This function fills SAP and Pst information to send the staInd to
651 * @param[in] Inst inst
652 * @param[in] RgUpSapCb *rguSap
653 * @param[in] RgRguDedStaInd *staInd
658 S16 rgUIMSndDedStaInd
662 RgRguDedStaInd *staInd
667 DU_LOG("\nINFO --> MAC : rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd);
669 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
673 DU_LOG("\nERROR --> MAC : RgUiRguDStaInd Failed");
677 } /* rgUIMSndDedStaInd */
681 * @brief Handler for sending staInd to a common logical channel.
685 * Function : rgUIMSndCmnStaInd
687 * This function fills SAP and Pst information to send the staInd to
688 * a common logical channel.
691 * @param[in] Inst inst
692 * @param[in] RgUpSapCb *rguSap
693 * @param[in] RgRguCmnStaInd *staInd
698 S16 rgUIMSndCmnStaInd
702 RgRguCmnStaInd *staInd
707 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
711 DU_LOG("\nERROR --> MAC : RgUiRguCStaInd Failed");
715 } /* rgUIMSndCmnStaInd */
719 * @brief Handler for sending datInd to dedicated logical channels of a UE
723 * Function : rgUIMSndDedDatInd
725 * This function fills SAP and Pst information to send the datInd to
729 * @param[in] Inst inst
730 * @param[in] RgUpSapCb *rguUlSap
731 * @param[in] RgRguDedDatInd *datInd
736 S16 rgUIMSndDedDatInd
740 RgRguDedDatInd *datInd
745 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
747 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
751 DU_LOG("\nERROR --> MAC : RgUiRguDdatInd Failed");
755 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
756 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
759 } /* rgUIMSndDedDatInd */
763 * @brief Handler for sending datInd to a common logical channel.
767 * Function : rgUIMSndCmnDatInd
769 * This function fills SAP and Pst information to send the datInd to
770 * a common logical channel.
773 * @param[in] Inst inst
774 * @param[in] RgUpSapCb *rguSap
775 * @param[in] RgRguCmnDatInd *datInd
780 S16 rgUIMSndCmnDatInd(Inst inst,RgUpSapCb *rguUlSap,RgRguCmnDatInd *datInd)
784 DU_LOG("\nDEBUG --> MAC : rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd);
786 rguUlSap->sapSts.numPduTxmit++;
788 DU_LOG("\nDEBUG --> MAC : rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId);
789 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
793 DU_LOG("\nERROR --> MAC : RgUiRguCDatInd Failed");
797 } /* rgUIMSndCmnDatInd */
801 * @brief API for bind request from RRC towards MAC.
805 * Function: RgUiCrgBndReq
807 * This API is invoked by RRC towards MAC to bind CRG SAP.
808 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
811 * @param[in] Pst *pst
812 * @param[in] SuId suId
813 * @param[in] SpId spId
818 S16 RgUiCrgBndReq(Pst *pst, SuId suId,SpId spId)
821 Pst tmpPst; /* Temporary Post Structure */
822 RgUstaDgn dgn; /* Alarm diagnostics structure */
825 RG_IS_INST_VALID(pst->dstInst);
826 inst = pst->dstInst - RG_INST_START;
828 tmpPst.prior = pst->prior;
829 tmpPst.route = pst->route;
830 tmpPst.selector = pst->selector;
831 tmpPst.region = rgCb[inst].rgInit.region;
832 tmpPst.pool = rgCb[inst].rgInit.pool;
833 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
834 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
835 tmpPst.srcInst = rgCb[inst].rgInit.inst;
836 tmpPst.event = EVTNONE;
837 tmpPst.dstProcId = pst->srcProcId;
838 tmpPst.dstEnt = pst->srcEnt;
839 tmpPst.dstInst = pst->srcInst;
842 if(spId == rgCb[inst].crgSap.sapCfg.spId)
844 /* Check the state of the SAP */
845 switch (rgCb[inst].crgSap.sapSta.sapState)
847 case LRG_NOT_CFG: /* SAP Not configured */
849 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
850 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
851 LCM_CAUSE_INV_SAP, &dgn);
852 DU_LOG("\nDEBUG --> MAC : SAP Not Configured");
853 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
855 case LRG_UNBND: /* SAP is not bound */
856 DU_LOG("\nERROR --> MAC : SAP Not yet bound");
858 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
859 rgCb[inst].crgSap.sapCfg.suId = suId;
860 /* Send Bind Confirm with status as SUCCESS */
861 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
862 /* Indicate to Layer manager */
863 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
864 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
865 LCM_CAUSE_UNKNOWN, &dgn);
867 case LRG_BND: /* SAP is already bound*/
868 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
870 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
872 default: /* Should Never Enter here */
873 #if (ERRCLASS & ERRCLS_ADD_RES)
874 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgBndReq failed",
875 rgCb[inst].crgSap.sapSta.sapState);
877 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
883 #if (ERRCLASS & ERRCLS_ADD_RES)
884 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgBndReq failed",
885 rgCb[inst].crgSap.sapCfg.spId);
887 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
890 } /* RgUiCrgBndReq */
894 * @brief API for unbind request from RRC towards MAC.
898 * Function: RgUiCrgUbndReq
900 * This API is invoked by RRC towards MAC to unbind CRG SAP.
901 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
904 * @param[in] Pst *pst
905 * @param[in] SuId suId
906 * @param[in] Reason reason
911 S16 RgUiCrgUbndReq(Pst *pst,SpId spId,Reason reason)
915 RG_IS_INST_VALID(pst->dstInst);
916 inst = pst->dstInst - RG_INST_START;
917 /* SAP Id validation */
918 if (spId == rgCb[inst].crgSap.sapCfg.spId)
920 switch(rgCb[inst].crgSap.sapSta.sapState)
922 case LRG_BND: /* SAP is already bound*/
923 /* setting SAP state to UN BOUND */
924 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
926 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
929 #if (ERRCLASS & ERRCLS_ADD_RES)
930 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgUbndReq failed",
931 rgCb[inst].crgSap.sapSta.sapState);
938 #if (ERRCLASS & ERRCLS_ADD_RES)
939 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgUbndReq failed",
940 rgCb[inst].crgSap.sapCfg.spId);
945 } /* RgUiCrgUbndReq */
948 * @brief API for sending bind confirm from MAC to RRC
952 * Function: rgUIMRgrBndCfm
954 * This API is invoked to send bind confirm from MAC to RRC.
955 * This API fills in Pst structure and SAP Ids and invokes
956 * bind confirm API towards RRC.
958 * @param[in] Inst inst
959 * @param[in] SuId suId
960 * @param[in] uint8_t status
965 S16 rgUIMCrgBndCfm(Inst inst,SuId suId,uint8_t status)
968 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
970 DU_LOG("\nERROR --> MAC : RgUiCrgBndCfm Failed ");
975 } /* rgUIMCrgBndCfm*/
978 * @brief API for configuration request from RRC towards MAC.
982 * Function: RgUiCrgCfgReq
984 * This API is invoked by RRC towards MAC to configure MAC.
985 * These API validates the Pst, spId, suId and transfers the config request
986 * specific information to corresponding ownership module (COM) API.
989 * @param[in] Pst *pst
990 * @param[in] SpId spId
991 * @param[in] CrgCfgTransId transId
992 * @param[in] CrgCfgReqInfo *cfgReqInfo
1001 CrgCfgTransId transId,
1002 CrgCfgReqInfo *cfgReqInfo
1007 uint8_t cfmStatus = 0x00ff;
1008 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1010 RG_IS_INST_VALID(pst->dstInst);
1011 inst = pst->dstInst - RG_INST_START;
1012 /* Ensuring transId is always Null terminated. */
1013 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1014 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1017 /* CrgCfgReqInfo Validation for NULLP */
1018 if (cfgReqInfo == NULLP)
1020 DU_LOG("\nERROR --> MAC : Input Param crgReqInfo is NULL ");
1021 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1025 /* Upper SAP Id and State validation */
1026 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1028 switch(rgCb[inst].crgSap.sapSta.sapState)
1030 case LRG_BND: /* SAP is already bound */
1031 DU_LOG("\nDEBUG --> MAC : SAP is already bound");
1033 default: /* Should never reach here */
1034 #if (ERRCLASS & ERRCLS_ADD_RES)
1035 DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgCfgReq failed",
1036 rgCb[inst].crgSap.sapSta.sapState);
1038 MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
1040 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1046 #if (ERRCLASS & ERRCLS_ADD_RES)
1047 DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgCfgReq failed",
1048 rgCb[inst].crgSap.sapCfg.spId);
1050 MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
1051 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1054 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1055 MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
1058 DU_LOG("\nERROR --> MAC : Configuration Request Handling Failed ");
1063 } /* RgUiCrgCfgReq */
1066 * @brief API for sending configuration confirm from MAC to RRC
1070 * Function: rgUIMCrgCfgCfm
1072 * This API is invoked to send configuration confirm from MAC to RRC.
1073 * This API fills in Pst structure and SAP Ids and invokes
1074 * config confirm API towards RRC.
1076 * @param[in] Inst inst
1077 * @param[in] CrgCfgTransId transId
1078 * @param[in] uint8_t status
1086 CrgCfgTransId transId,
1091 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1093 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1094 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1097 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1100 DU_LOG("\nERROR --> MAC : RgUiCrgCfgCfm Failed ");
1105 } /* rgUIMCrgCfgCfm */
1106 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1108 S16 rgBatchProc(Void)
1110 /* Read from Ring Buffer and process RLC BO Update */
1113 RguDStaRspInfo *staRsp;
1114 uint32_t elmIndx = 0;
1119 pst.dstEnt = ENTMAC;
1121 pst.srcEnt = ENTRLC;
1124 pst.route = RTESPEC;
1125 pst.event = EVTRGUDSTARSP;
1128 pst.selector = 2; /*SM_SELECTOR_LC */
1132 elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1133 while(NULLP != elmIndx)
1135 staRsp = (RguDStaRspInfo *)elmIndx;
1139 RgUiRguDStaRsp(&pst, spId, staRsp);
1143 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1145 if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1152 /**********************************************************************
1155 **********************************************************************/