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.
36 static const char* RLOG_MODULE_NAME="MAC";
37 static int RLOG_MODULE_ID=4096;
38 static int RLOG_FILE_ID=178;
40 /* header include files -- defines (.h) */
42 /* header/extern include files (.x) */
43 /* header include files (.h) */
44 #include "common_def.h"
45 #include "crg.h" /* CRG defines */
46 #include "lrg.h" /* layer management defines for LTE-MAC */
49 #include "rg_sch_inf.h"
50 #include "rg_env.h" /* customizable defines and macros for MAC */
51 #include "rg.h" /* defines and macros for MAC */
52 #include "rg_err.h" /* RG error defines */
54 /* header/extern include files (.x) */
56 #include "crg.x" /* CRG types */
57 #include "lrg.x" /* layer management typedefs for MAC */
60 #include "rg_sch_inf.x"
61 #include "rg_prg.x" /* PRG interface typedefs*/
62 #include "du_app_mac_inf.h"
63 #include "rg.x" /* typedefs for MAC */
74 /* forward references */
76 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
77 S16 rgBatchProc(Void);
82 * @brief Handler for Bind request.
86 * Function : RgUiRguBndReq
88 * This function handles the bind request from MAC Service User.
92 * @param[in] SuId suId
93 * @param[in] SpId spId
106 S16 RgUiRguBndReq(pst, suId, spId)
114 Pst tmpPst; /* Temporary Post Structure */
115 RgUstaDgn dgn; /* Alarm diagnostics structure */
120 RG_IS_INST_VALID(pst->dstInst);
121 inst = pst->dstInst - RG_INST_START;
123 tmpPst.prior = pst->prior;
124 tmpPst.route = pst->route;
125 tmpPst.selector = pst->selector;
126 tmpPst.region = rgCb[inst].rgInit.region;
127 tmpPst.pool = rgCb[inst].rgInit.pool;
128 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
129 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
130 tmpPst.srcInst = rgCb[inst].rgInit.inst;
131 tmpPst.event = EVTNONE;
132 tmpPst.dstProcId = pst->srcProcId;
133 tmpPst.dstEnt = pst->srcEnt;
134 tmpPst.dstInst = pst->srcInst;
136 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
138 /* Check the state of the SAP */
139 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
141 case LRG_NOT_CFG: /* SAP Not configured */
142 RGDBGINFO(inst,(rgPBuf(inst), "SAP Not Configured\n"));
143 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
144 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
145 LCM_CAUSE_INV_SAP, &dgn);
146 RLOG0(L_DEBUG,"SAP Not Configured");
147 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
149 case LRG_UNBND: /* SAP is not bound */
150 RLOG0(L_DEBUG,"SAP Not yet bound");
151 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
152 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
153 /* Send Bind Confirm with status as SUCCESS */
154 /*T2K - Passing spId as it is required to access the SAP CB*/
155 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
156 /* Indicate to Layer manager */
157 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
158 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
159 LCM_CAUSE_UNKNOWN, &dgn);
161 case LRG_BND: /* SAP is already bound*/
162 RLOG0(L_DEBUG,"SAP already bound");
163 /*T2K - Passing spId as it is required to access the SAP CB*/
164 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
166 default: /* Should Never Enter here */
167 #if (ERRCLASS & ERRCLS_ADD_RES)
168 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG008, (ErrVal)rgCb[inst].rguSap[spId].sapSta.sapState,
169 "Invalid SAP State:RgUiRguBndReq failed\n");
171 /*T2K - Passing spId as it is required to access the SAP CB*/
172 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
178 #if (ERRCLASS & ERRCLS_ADD_RES)
179 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG009, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
180 "Invalid SAP Id:RgUiRguBndReq failed\n");
182 /*T2K - Passing spId as it is required to access the SAP CB*/
183 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
186 } /* RgUiRguBndReq */
190 * @brief Handler for Unbind request.
194 * Function : RgUiRguUbndReq
196 * This function handles the unbind request from MAC Service User.
199 * @param[in] Pst *pst
200 * @param[in] SpId spId
201 * @param[in] Reason reason
214 S16 RgUiRguUbndReq(pst, spId, reason)
224 RG_IS_INST_VALID(pst->dstInst);
225 inst = pst->dstInst - RG_INST_START;
226 /* SAP Id validation */
227 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
229 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
231 case LRG_BND: /* SAP is already bound*/
232 RLOG0(L_DEBUG,"SAP already bound");
233 /* setting SAP state to UN BOUND */
234 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
237 #if (ERRCLASS & ERRCLS_ADD_RES)
238 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguUbndReq failed",
239 rgCb[inst].rguSap[spId].sapSta.sapState);
247 #if (ERRCLASS & ERRCLS_ADD_RES)
248 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG011, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
249 "Invalid SAP Id:RgUiRguUbndReq failed\n");
254 } /* RgUiRguUbndReq */
256 * @brief API for sending bind confirm from MAC to RLC
260 * Function: rgUIMRguBndCfm
262 * This API is invoked to send bind confirm from MAC to RLC.
263 * This API fills in Pst structure and SAP Ids and invokes
264 * bind confirm API towards RLC.
266 * @param[in] Inst inst
267 * @param[in] SuId suId
268 * @param[in] U8 status
281 S16 rgUIMRguBndCfm(inst,spId, status)
292 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
293 rgCb[inst].rguSap[spId].sapCfg.suId, status);
297 RLOG0(L_ERROR,"RgUiRguBndCfm Failed ");
301 } /* rgUIMRguBndCfm*/
305 * @brief Handler for dedicated DatReq from RGU
309 * Function : RgUiRguDDatReq
311 * This function validates SAP and invokes ROM for further processing
313 * @param[in] Pst *pst
314 * @param[in] SpId spId
315 * @param[in] RguDDatReqInfo *datReq
325 RguDDatReqInfo *datReq
328 S16 RgUiRguDDatReq(pst, spId, datReq)
331 RguDDatReqInfo *datReq;
346 RG_IS_INST_VALID(pst->dstInst);
347 inst = pst->dstInst - RG_INST_START;
351 RLOG0(L_ERROR,"Input Message Buffer is NULL");
355 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
357 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
359 case LRG_BND: /* SAP is bound */
360 RLOG0(L_DEBUG,"SAP is already bound");
362 default: /* Should never reach here */
363 #if (ERRCLASS & ERRCLS_ADD_RES)
364 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguDDatReq failed",
365 rgCb[inst].rguSap[spId].sapSta.sapState);
368 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
370 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
378 #if (ERRCLASS & ERRCLS_ADD_RES)
379 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG013, (ErrVal)spId,
380 "Invalid SAP Id:RgUiRguDDatReq failed\n");
383 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
385 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
391 /* Update RGU SAP statistics for received sdu count */
392 /*ccpu00118201 - ADD - Send trace only when its enabled*/
393 if(rgCb[inst].rgInit.trc)
395 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
397 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
398 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
400 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
402 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
403 * rgROMDedDatReq -> rgUpdtRguDedSts function
404 * So numPduRcvd updation is commented here */
405 /* rgCb.rguSap.sapSts.numPduRcvd +=
406 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
407 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
409 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
410 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
418 /* Call Ownership module for further processing */
419 ret = rgROMDedDatReq(inst,datReq);
420 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
423 } /* RgUiRguDDatReq */
427 * @brief Handler for common DatReq from RGU
431 * Function : RgUiRguCDatReq
433 * This function validates SAP invokes ROM for further processing
435 * @param[in] Pst *pst
436 * @param[in] SpId spId
437 * @param[in] RguCDatReqInfo *datReq
447 RguCDatReqInfo *datReq
450 S16 RgUiRguCDatReq(pst, spId, datReq)
453 RguCDatReqInfo *datReq;
462 RG_IS_INST_VALID(pst->dstInst);
463 inst = pst->dstInst - RG_INST_START;
467 RLOG0(L_ERROR,"Input Message Buffer is NULL");
471 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
473 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
475 case LRG_BND: /* SAP is bound */
476 RLOG0(L_DEBUG,"SAP is already bound");
478 default: /* Should never reach here */
479 #if (ERRCLASS & ERRCLS_ADD_RES)
480 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCDatReq failed",
481 rgCb[inst].rguSap[spId].sapSta.sapState);
488 #if (ERRCLASS & ERRCLS_ADD_RES)
489 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
495 /* Update RGU SAP statistics for received sdu count */
496 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
497 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
498 * So numPduRcvd updation is commented here */
499 /* rgCb.rguSap.sapSts.numPduRcvd++; */
501 ret = rgROMCmnDatReq(inst,datReq);
502 /*ccpu00118201 - ADD - Send trace only when its enabled*/
503 if(rgCb[inst].rgInit.trc)
505 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
509 RG_DROP_RGUCDATREQ_MBUF(datReq);
511 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
514 } /* RgUiRguCDatReq */
518 * @brief Handler for dedicated StaRsp from RGU
522 * Function : RgUiRguDStaRsp
524 * This function validates SAP and invokes ROM for further processing
526 * @param[in] Pst *pst
527 * @param[in] SpId spId
528 * @param[in] RguDStaRspInfo *staRsp
538 RguDStaRspInfo *staRsp
541 S16 RgUiRguDStaRsp(pst, spId, staRsp)
544 RguDStaRspInfo *staRsp;
550 VOLATILE U32 startTime = 0;
554 RG_IS_INST_VALID(pst->dstInst);
555 inst = pst->dstInst - RG_INST_START;
557 SStartTask(&startTime, PID_MAC_STA_RSP);
559 ret = rgROMDedStaRsp(inst,staRsp);
562 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
563 "Processing Of Status Response Failed");
568 SStopTask(startTime, PID_MAC_STA_RSP);
570 } /* RgUiRguDStaRsp */
574 * @brief Handler for common StaRsp from RGU
578 * Function : RgUiRguCStaRsp
580 * This function validates SAP and invokes ROM
581 * for further processing
584 * @param[in] Pst *pst
585 * @param[in] SpId spId
586 * @param[in] RguCStaRspInfo *staRsp
596 RguCStaRspInfo *staRsp
599 S16 RgUiRguCStaRsp(pst, spId, staRsp)
602 RguCStaRspInfo *staRsp;
611 RG_IS_INST_VALID(pst->dstInst);
612 inst = pst->dstInst - RG_INST_START;
616 RLOG0(L_ERROR,"Input Response Buffer is NULL");
620 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
622 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
624 case LRG_BND: /* SAP is bound */
625 RLOG0(L_DEBUG,"SAP is already bound");
627 default: /* Should never reach here */
628 #if (ERRCLASS & ERRCLS_ADD_RES)
629 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
630 rgCb[inst].rguSap[spId].sapSta.sapState);
637 #if (ERRCLASS & ERRCLS_ADD_RES)
638 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
644 ret = rgROMCmnStaRsp(inst,staRsp);
647 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
651 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
654 } /* RgUiRguCStaRsp */
659 * @brief Handler for L2M MeasReq from RGU
663 * Function :RgUiRguL2MUlThrpMeasReq
665 * This function validates SAP and invokes ROM for further processing
667 * @param[in] Pst *pst
668 * @param[in] SpId spId
669 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
675 S16 RgUiRguL2MUlThrpMeasReq
679 RguL2MUlThrpMeasReqInfo *measReq
682 S16 RgUiRguL2MUlThrpMeasReq(pst, spId, measReq)
685 RguL2MUlThrpMeasReqInfo *measReq;
692 TRC3(RgUiRguL2MUlThrpMeasReq)
695 RG_IS_INST_VALID(pst->dstInst);
696 inst = pst->dstInst - RG_INST_START;
698 if (measReq == NULLP)
700 RLOG0(L_ERROR,"Input Response Buffer is NULL");
704 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
706 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
708 case LRG_BND: /* SAP is bound */
709 RLOG0(L_DEBUG,"SAP is already bound");
711 default: /* Should never reach here */
712 #if (ERRCLASS & ERRCLS_ADD_RES)
713 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
714 rgCb[inst].rguSap[spId].sapSta.sapState);
721 #if (ERRCLASS & ERRCLS_ADD_RES)
722 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
728 ret = rgROML2MUlThrpMeasReq(inst,measReq);
731 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
734 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
737 } /* RgUiRguL2MUlThrpMeasReq */
741 * @brief Handler for sending staInd to dedicated logical channels of a UE
745 * Function : rgUIMSndDedStaInd
747 * This function fills SAP and Pst information to send the staInd to
751 * @param[in] Inst inst
752 * @param[in] RgUpSapCb *rguSap
753 * @param[in] RgRguDedStaInd *staInd
759 S16 rgUIMSndDedStaInd
763 RgRguDedStaInd *staInd
766 S16 rgUIMSndDedStaInd(inst,rguSap,staInd)
769 RgRguDedStaInd *staInd;
774 TRC2(rgUIMSndDedStaInd)
776 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
778 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
782 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
786 } /* rgUIMSndDedStaInd */
790 * @brief Handler for sending staInd to a common logical channel.
794 * Function : rgUIMSndCmnStaInd
796 * This function fills SAP and Pst information to send the staInd to
797 * a common logical channel.
800 * @param[in] Inst inst
801 * @param[in] RgUpSapCb *rguSap
802 * @param[in] RgRguCmnStaInd *staInd
808 S16 rgUIMSndCmnStaInd
812 RgRguCmnStaInd *staInd
815 S16 rgUIMSndCmnStaInd(inst,rguDlSap,staInd)
818 RgRguCmnStaInd *staInd;
824 TRC2(rgUIMSndCmnStaInd)
827 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
831 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
835 } /* rgUIMSndCmnStaInd */
839 * @brief Handler for sending datInd to dedicated logical channels of a UE
843 * Function : rgUIMSndDedDatInd
845 * This function fills SAP and Pst information to send the datInd to
849 * @param[in] Inst inst
850 * @param[in] RgUpSapCb *rguUlSap
851 * @param[in] RgRguDedDatInd *datInd
857 S16 rgUIMSndDedDatInd
861 RgRguDedDatInd *datInd
864 S16 rgUIMSndDedDatInd(datInd)
867 RgRguDedDatInd *datInd;
873 TRC2(rgUIMSndDedDatInd)
876 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
878 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
882 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
886 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
887 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
890 } /* rgUIMSndDedDatInd */
894 * @brief Handler for sending datInd to a common logical channel.
898 * Function : rgUIMSndCmnDatInd
900 * This function fills SAP and Pst information to send the datInd to
901 * a common logical channel.
904 * @param[in] Inst inst
905 * @param[in] RgUpSapCb *rguSap
906 * @param[in] RgRguCmnDatInd *datInd
912 S16 rgUIMSndCmnDatInd
916 RgRguCmnDatInd *datInd
919 S16 rgUIMSndCmnDatInd(datInd)
922 RgRguCmnDatInd *datInd;
927 TRC2(rgUIMSndCmnDatInd)
930 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
932 rguUlSap->sapSts.numPduTxmit++;
934 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
935 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
939 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
940 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
944 } /* rgUIMSndCmnDatInd */
948 * @brief API for bind request from RRC towards MAC.
952 * Function: RgUiCrgBndReq
954 * This API is invoked by RRC towards MAC to bind CRG SAP.
955 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
958 * @param[in] Pst *pst
959 * @param[in] SuId suId
960 * @param[in] SpId spId
973 S16 RgUiCrgBndReq(pst, suId, spId)
980 Pst tmpPst; /* Temporary Post Structure */
981 RgUstaDgn dgn; /* Alarm diagnostics structure */
987 RG_IS_INST_VALID(pst->dstInst);
988 inst = pst->dstInst - RG_INST_START;
990 tmpPst.prior = pst->prior;
991 tmpPst.route = pst->route;
992 tmpPst.selector = pst->selector;
993 tmpPst.region = rgCb[inst].rgInit.region;
994 tmpPst.pool = rgCb[inst].rgInit.pool;
995 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
996 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
997 tmpPst.srcInst = rgCb[inst].rgInit.inst;
998 tmpPst.event = EVTNONE;
999 tmpPst.dstProcId = pst->srcProcId;
1000 tmpPst.dstEnt = pst->srcEnt;
1001 tmpPst.dstInst = pst->srcInst;
1004 if(spId == rgCb[inst].crgSap.sapCfg.spId)
1006 /* Check the state of the SAP */
1007 switch (rgCb[inst].crgSap.sapSta.sapState)
1009 case LRG_NOT_CFG: /* SAP Not configured */
1011 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1012 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
1013 LCM_CAUSE_INV_SAP, &dgn);
1014 RLOG0(L_DEBUG,"SAP Not Configured");
1015 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
1017 case LRG_UNBND: /* SAP is not bound */
1018 RLOG0(L_DEBUG,"SAP Not yet bound");
1020 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
1021 rgCb[inst].crgSap.sapCfg.suId = suId;
1022 /* Send Bind Confirm with status as SUCCESS */
1023 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1024 /* Indicate to Layer manager */
1025 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1026 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
1027 LCM_CAUSE_UNKNOWN, &dgn);
1029 case LRG_BND: /* SAP is already bound*/
1030 RLOG0(L_DEBUG,"SAP is already bound");
1032 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1034 default: /* Should Never Enter here */
1035 #if (ERRCLASS & ERRCLS_ADD_RES)
1036 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
1037 rgCb[inst].crgSap.sapSta.sapState);
1039 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1045 #if (ERRCLASS & ERRCLS_ADD_RES)
1046 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
1047 rgCb[inst].crgSap.sapCfg.spId);
1049 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1052 } /* RgUiCrgBndReq */
1056 * @brief API for unbind request from RRC towards MAC.
1060 * Function: RgUiCrgUbndReq
1062 * This API is invoked by RRC towards MAC to unbind CRG SAP.
1063 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
1066 * @param[in] Pst *pst
1067 * @param[in] SuId suId
1068 * @param[in] Reason reason
1081 S16 RgUiCrgUbndReq(pst, spId, reason)
1088 TRC3(RgUiCrgUbndReq)
1091 RG_IS_INST_VALID(pst->dstInst);
1092 inst = pst->dstInst - RG_INST_START;
1093 /* SAP Id validation */
1094 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1096 switch(rgCb[inst].crgSap.sapSta.sapState)
1098 case LRG_BND: /* SAP is already bound*/
1099 /* setting SAP state to UN BOUND */
1100 RLOG0(L_DEBUG, "SAP is already bound");
1102 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
1105 #if (ERRCLASS & ERRCLS_ADD_RES)
1106 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
1107 rgCb[inst].crgSap.sapSta.sapState);
1114 #if (ERRCLASS & ERRCLS_ADD_RES)
1115 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
1116 rgCb[inst].crgSap.sapCfg.spId);
1121 } /* RgUiCrgUbndReq */
1124 * @brief API for sending bind confirm from MAC to RRC
1128 * Function: rgUIMRgrBndCfm
1130 * This API is invoked to send bind confirm from MAC to RRC.
1131 * This API fills in Pst structure and SAP Ids and invokes
1132 * bind confirm API towards RRC.
1134 * @param[in] Inst inst
1135 * @param[in] SuId suId
1136 * @param[in] U8 status
1149 S16 rgUIMCrgBndCfm(inst,suId, status)
1155 TRC2(rgUIMCrgBndCfm)
1158 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
1160 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
1165 } /* rgUIMCrgBndCfm*/
1168 * @brief API for configuration request from RRC towards MAC.
1172 * Function: RgUiCrgCfgReq
1174 * This API is invoked by RRC towards MAC to configure MAC.
1175 * These API validates the Pst, spId, suId and transfers the config request
1176 * specific information to corresponding ownership module (COM) API.
1179 * @param[in] Pst *pst
1180 * @param[in] SpId spId
1181 * @param[in] CrgCfgTransId transId
1182 * @param[in] CrgCfgReqInfo *cfgReqInfo
1192 CrgCfgTransId transId,
1193 CrgCfgReqInfo *cfgReqInfo
1196 S16 RgUiCrgCfgReq(pst, spId, transId, cfgReqInfo)
1199 CrgCfgTransId transId;
1200 CrgCfgReqInfo *cfgReqInfo;
1205 U8 cfmStatus = 0x00ff;
1206 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1208 TRC3(RgUiCrgCfgReq);
1210 RG_IS_INST_VALID(pst->dstInst);
1211 inst = pst->dstInst - RG_INST_START;
1212 /* Ensuring transId is always Null terminated. */
1213 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1214 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1217 /* CrgCfgReqInfo Validation for NULLP */
1218 if (cfgReqInfo == NULLP)
1220 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1221 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1225 /* Upper SAP Id and State validation */
1226 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1228 switch(rgCb[inst].crgSap.sapSta.sapState)
1230 case LRG_BND: /* SAP is already bound */
1231 RLOG0(L_DEBUG,"SAP is already bound");
1233 default: /* Should never reach here */
1234 #if (ERRCLASS & ERRCLS_ADD_RES)
1235 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1236 rgCb[inst].crgSap.sapSta.sapState);
1238 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1239 sizeof(CrgCfgReqInfo));
1242 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1248 #if (ERRCLASS & ERRCLS_ADD_RES)
1249 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1250 rgCb[inst].crgSap.sapCfg.spId);
1252 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1253 sizeof(CrgCfgReqInfo));
1255 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1258 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1259 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1260 sizeof(CrgCfgReqInfo));
1264 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1269 } /* RgUiCrgCfgReq */
1272 * @brief API for sending configuration confirm from MAC to RRC
1276 * Function: rgUIMCrgCfgCfm
1278 * This API is invoked to send configuration confirm from MAC to RRC.
1279 * This API fills in Pst structure and SAP Ids and invokes
1280 * config confirm API towards RRC.
1282 * @param[in] Inst inst
1283 * @param[in] CrgCfgTransId transId
1284 * @param[in] U8 status
1293 CrgCfgTransId transId,
1297 S16 rgUIMCrgCfgCfm(inst,transId, status)
1299 CrgCfgTransId transId;
1304 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1306 TRC2(rgUIMCrgCfgCfm)
1308 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1309 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1312 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1315 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1320 } /* rgUIMCrgCfgCfm */
1321 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1333 /* Read from Ring Buffer and process RLC BO Update */
1336 RguDStaRspInfo *staRsp;
1342 pst.dstEnt = ENTMAC;
1344 pst.srcEnt = ENTRLC;
1347 pst.route = RTESPEC;
1348 pst.event = EVTRGUDSTARSP;
1351 pst.selector = 2; /*SM_SELECTOR_LC */
1355 elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1356 while(NULLP != elmIndx)
1358 staRsp = (RguDStaRspInfo *)elmIndx;
1362 RgUiRguDStaRsp(&pst, spId, staRsp);
1366 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1368 if((elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1375 /**********************************************************************
1378 **********************************************************************/