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 */
117 RG_IS_INST_VALID(pst->dstInst);
118 inst = pst->dstInst - RG_INST_START;
120 tmpPst.prior = pst->prior;
121 tmpPst.route = pst->route;
122 tmpPst.selector = pst->selector;
123 tmpPst.region = rgCb[inst].rgInit.region;
124 tmpPst.pool = rgCb[inst].rgInit.pool;
125 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
126 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
127 tmpPst.srcInst = rgCb[inst].rgInit.inst;
128 tmpPst.event = EVTNONE;
129 tmpPst.dstProcId = pst->srcProcId;
130 tmpPst.dstEnt = pst->srcEnt;
131 tmpPst.dstInst = pst->srcInst;
133 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
135 /* Check the state of the SAP */
136 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
138 case LRG_NOT_CFG: /* SAP Not configured */
139 RGDBGINFO(inst,(rgPBuf(inst), "SAP Not Configured\n"));
140 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
141 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
142 LCM_CAUSE_INV_SAP, &dgn);
143 RLOG0(L_DEBUG,"SAP Not Configured");
144 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
146 case LRG_UNBND: /* SAP is not bound */
147 RLOG0(L_DEBUG,"SAP Not yet bound");
148 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
149 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
150 /* Send Bind Confirm with status as SUCCESS */
151 /*T2K - Passing spId as it is required to access the SAP CB*/
152 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
153 /* Indicate to Layer manager */
154 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
155 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
156 LCM_CAUSE_UNKNOWN, &dgn);
158 case LRG_BND: /* SAP is already bound*/
159 RLOG0(L_DEBUG,"SAP already bound");
160 /*T2K - Passing spId as it is required to access the SAP CB*/
161 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
163 default: /* Should Never Enter here */
164 #if (ERRCLASS & ERRCLS_ADD_RES)
165 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG008, (ErrVal)rgCb[inst].rguSap[spId].sapSta.sapState,
166 "Invalid SAP State:RgUiRguBndReq failed\n");
168 /*T2K - Passing spId as it is required to access the SAP CB*/
169 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
175 #if (ERRCLASS & ERRCLS_ADD_RES)
176 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG009, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
177 "Invalid SAP Id:RgUiRguBndReq failed\n");
179 /*T2K - Passing spId as it is required to access the SAP CB*/
180 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
183 } /* RgUiRguBndReq */
187 * @brief Handler for Unbind request.
191 * Function : RgUiRguUbndReq
193 * This function handles the unbind request from MAC Service User.
196 * @param[in] Pst *pst
197 * @param[in] SpId spId
198 * @param[in] Reason reason
211 S16 RgUiRguUbndReq(pst, spId, reason)
219 RG_IS_INST_VALID(pst->dstInst);
220 inst = pst->dstInst - RG_INST_START;
221 /* SAP Id validation */
222 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
224 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
226 case LRG_BND: /* SAP is already bound*/
227 RLOG0(L_DEBUG,"SAP already bound");
228 /* setting SAP state to UN BOUND */
229 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
232 #if (ERRCLASS & ERRCLS_ADD_RES)
233 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguUbndReq failed",
234 rgCb[inst].rguSap[spId].sapSta.sapState);
242 #if (ERRCLASS & ERRCLS_ADD_RES)
243 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG011, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
244 "Invalid SAP Id:RgUiRguUbndReq failed\n");
249 } /* RgUiRguUbndReq */
251 * @brief API for sending bind confirm from MAC to RLC
255 * Function: rgUIMRguBndCfm
257 * This API is invoked to send bind confirm from MAC to RLC.
258 * This API fills in Pst structure and SAP Ids and invokes
259 * bind confirm API towards RLC.
261 * @param[in] Inst inst
262 * @param[in] SuId suId
263 * @param[in] uint8_t status
276 S16 rgUIMRguBndCfm(inst,spId, status)
284 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
285 rgCb[inst].rguSap[spId].sapCfg.suId, status);
289 RLOG0(L_ERROR,"RgUiRguBndCfm Failed ");
293 } /* rgUIMRguBndCfm*/
297 * @brief Handler for dedicated DatReq from RGU
301 * Function : RgUiRguDDatReq
303 * This function validates SAP and invokes ROM for further processing
305 * @param[in] Pst *pst
306 * @param[in] SpId spId
307 * @param[in] RguDDatReqInfo *datReq
317 RguDDatReqInfo *datReq
320 S16 RgUiRguDDatReq(pst, spId, datReq)
323 RguDDatReqInfo *datReq;
335 RG_IS_INST_VALID(pst->dstInst);
336 inst = pst->dstInst - RG_INST_START;
340 RLOG0(L_ERROR,"Input Message Buffer is NULL");
344 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
346 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
348 case LRG_BND: /* SAP is bound */
349 RLOG0(L_DEBUG,"SAP is already bound");
351 default: /* Should never reach here */
352 #if (ERRCLASS & ERRCLS_ADD_RES)
353 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguDDatReq failed",
354 rgCb[inst].rguSap[spId].sapSta.sapState);
357 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
359 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
367 #if (ERRCLASS & ERRCLS_ADD_RES)
368 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG013, (ErrVal)spId,
369 "Invalid SAP Id:RgUiRguDDatReq failed\n");
372 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
374 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
380 /* Update RGU SAP statistics for received sdu count */
381 /*ccpu00118201 - ADD - Send trace only when its enabled*/
382 if(rgCb[inst].rgInit.trc)
384 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
386 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
387 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
389 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
391 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
392 * rgROMDedDatReq -> rgUpdtRguDedSts function
393 * So numPduRcvd updation is commented here */
394 /* rgCb.rguSap.sapSts.numPduRcvd +=
395 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
396 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
398 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
399 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
407 /* Call Ownership module for further processing */
408 ret = rgROMDedDatReq(inst,datReq);
409 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
412 } /* RgUiRguDDatReq */
416 * @brief Handler for common DatReq from RGU
420 * Function : RgUiRguCDatReq
422 * This function validates SAP invokes ROM for further processing
424 * @param[in] Pst *pst
425 * @param[in] SpId spId
426 * @param[in] RguCDatReqInfo *datReq
436 RguCDatReqInfo *datReq
439 S16 RgUiRguCDatReq(pst, spId, datReq)
442 RguCDatReqInfo *datReq;
448 RG_IS_INST_VALID(pst->dstInst);
449 inst = pst->dstInst - RG_INST_START;
453 RLOG0(L_ERROR,"Input Message Buffer is NULL");
457 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
459 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
461 case LRG_BND: /* SAP is bound */
462 RLOG0(L_DEBUG,"SAP is already bound");
464 default: /* Should never reach here */
465 #if (ERRCLASS & ERRCLS_ADD_RES)
466 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCDatReq failed",
467 rgCb[inst].rguSap[spId].sapSta.sapState);
474 #if (ERRCLASS & ERRCLS_ADD_RES)
475 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
481 /* Update RGU SAP statistics for received sdu count */
482 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
483 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
484 * So numPduRcvd updation is commented here */
485 /* rgCb.rguSap.sapSts.numPduRcvd++; */
487 ret = rgROMCmnDatReq(inst,datReq);
488 /*ccpu00118201 - ADD - Send trace only when its enabled*/
489 if(rgCb[inst].rgInit.trc)
491 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
495 RG_DROP_RGUCDATREQ_MBUF(datReq);
497 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
500 } /* RgUiRguCDatReq */
504 * @brief Handler for dedicated StaRsp from RGU
508 * Function : RgUiRguDStaRsp
510 * This function validates SAP and invokes ROM for further processing
512 * @param[in] Pst *pst
513 * @param[in] SpId spId
514 * @param[in] RguDStaRspInfo *staRsp
524 RguDStaRspInfo *staRsp
527 S16 RgUiRguDStaRsp(pst, spId, staRsp)
530 RguDStaRspInfo *staRsp;
535 VOLATILE uint32_t startTime = 0;
537 RG_IS_INST_VALID(pst->dstInst);
538 inst = pst->dstInst - RG_INST_START;
540 SStartTask(&startTime, PID_MAC_STA_RSP);
542 ret = rgROMDedStaRsp(inst,staRsp);
545 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
546 "Processing Of Status Response Failed");
551 SStopTask(startTime, PID_MAC_STA_RSP);
553 } /* RgUiRguDStaRsp */
557 * @brief Handler for common StaRsp from RGU
561 * Function : RgUiRguCStaRsp
563 * This function validates SAP and invokes ROM
564 * for further processing
567 * @param[in] Pst *pst
568 * @param[in] SpId spId
569 * @param[in] RguCStaRspInfo *staRsp
579 RguCStaRspInfo *staRsp
582 S16 RgUiRguCStaRsp(pst, spId, staRsp)
585 RguCStaRspInfo *staRsp;
591 RG_IS_INST_VALID(pst->dstInst);
592 inst = pst->dstInst - RG_INST_START;
596 RLOG0(L_ERROR,"Input Response Buffer is NULL");
600 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
602 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
604 case LRG_BND: /* SAP is bound */
605 RLOG0(L_DEBUG,"SAP is already bound");
607 default: /* Should never reach here */
608 #if (ERRCLASS & ERRCLS_ADD_RES)
609 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
610 rgCb[inst].rguSap[spId].sapSta.sapState);
617 #if (ERRCLASS & ERRCLS_ADD_RES)
618 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
624 ret = rgROMCmnStaRsp(inst,staRsp);
627 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
631 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
634 } /* RgUiRguCStaRsp */
639 * @brief Handler for L2M MeasReq from RGU
643 * Function :RgUiRguL2MUlThrpMeasReq
645 * This function validates SAP and invokes ROM for further processing
647 * @param[in] Pst *pst
648 * @param[in] SpId spId
649 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
655 S16 RgUiRguL2MUlThrpMeasReq
659 RguL2MUlThrpMeasReqInfo *measReq
662 S16 RgUiRguL2MUlThrpMeasReq(pst, spId, measReq)
665 RguL2MUlThrpMeasReqInfo *measReq;
672 RG_IS_INST_VALID(pst->dstInst);
673 inst = pst->dstInst - RG_INST_START;
675 if (measReq == NULLP)
677 RLOG0(L_ERROR,"Input Response Buffer is NULL");
681 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
683 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
685 case LRG_BND: /* SAP is bound */
686 RLOG0(L_DEBUG,"SAP is already bound");
688 default: /* Should never reach here */
689 #if (ERRCLASS & ERRCLS_ADD_RES)
690 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
691 rgCb[inst].rguSap[spId].sapSta.sapState);
698 #if (ERRCLASS & ERRCLS_ADD_RES)
699 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
705 ret = rgROML2MUlThrpMeasReq(inst,measReq);
708 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
711 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
714 } /* RgUiRguL2MUlThrpMeasReq */
718 * @brief Handler for sending staInd to dedicated logical channels of a UE
722 * Function : rgUIMSndDedStaInd
724 * This function fills SAP and Pst information to send the staInd to
728 * @param[in] Inst inst
729 * @param[in] RgUpSapCb *rguSap
730 * @param[in] RgRguDedStaInd *staInd
736 S16 rgUIMSndDedStaInd
740 RgRguDedStaInd *staInd
743 S16 rgUIMSndDedStaInd(inst,rguSap,staInd)
746 RgRguDedStaInd *staInd;
751 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
753 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
757 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
761 } /* rgUIMSndDedStaInd */
765 * @brief Handler for sending staInd to a common logical channel.
769 * Function : rgUIMSndCmnStaInd
771 * This function fills SAP and Pst information to send the staInd to
772 * a common logical channel.
775 * @param[in] Inst inst
776 * @param[in] RgUpSapCb *rguSap
777 * @param[in] RgRguCmnStaInd *staInd
783 S16 rgUIMSndCmnStaInd
787 RgRguCmnStaInd *staInd
790 S16 rgUIMSndCmnStaInd(inst,rguDlSap,staInd)
793 RgRguCmnStaInd *staInd;
798 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
802 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
806 } /* rgUIMSndCmnStaInd */
810 * @brief Handler for sending datInd to dedicated logical channels of a UE
814 * Function : rgUIMSndDedDatInd
816 * This function fills SAP and Pst information to send the datInd to
820 * @param[in] Inst inst
821 * @param[in] RgUpSapCb *rguUlSap
822 * @param[in] RgRguDedDatInd *datInd
828 S16 rgUIMSndDedDatInd
832 RgRguDedDatInd *datInd
835 S16 rgUIMSndDedDatInd(datInd)
838 RgRguDedDatInd *datInd;
843 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
845 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
849 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
853 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
854 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
857 } /* rgUIMSndDedDatInd */
861 * @brief Handler for sending datInd to a common logical channel.
865 * Function : rgUIMSndCmnDatInd
867 * This function fills SAP and Pst information to send the datInd to
868 * a common logical channel.
871 * @param[in] Inst inst
872 * @param[in] RgUpSapCb *rguSap
873 * @param[in] RgRguCmnDatInd *datInd
879 S16 rgUIMSndCmnDatInd
883 RgRguCmnDatInd *datInd
886 S16 rgUIMSndCmnDatInd(datInd)
889 RgRguCmnDatInd *datInd;
894 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
896 rguUlSap->sapSts.numPduTxmit++;
898 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
899 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
903 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
904 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
908 } /* rgUIMSndCmnDatInd */
912 * @brief API for bind request from RRC towards MAC.
916 * Function: RgUiCrgBndReq
918 * This API is invoked by RRC towards MAC to bind CRG SAP.
919 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
922 * @param[in] Pst *pst
923 * @param[in] SuId suId
924 * @param[in] SpId spId
937 S16 RgUiCrgBndReq(pst, suId, spId)
944 Pst tmpPst; /* Temporary Post Structure */
945 RgUstaDgn dgn; /* Alarm diagnostics structure */
948 RG_IS_INST_VALID(pst->dstInst);
949 inst = pst->dstInst - RG_INST_START;
951 tmpPst.prior = pst->prior;
952 tmpPst.route = pst->route;
953 tmpPst.selector = pst->selector;
954 tmpPst.region = rgCb[inst].rgInit.region;
955 tmpPst.pool = rgCb[inst].rgInit.pool;
956 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
957 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
958 tmpPst.srcInst = rgCb[inst].rgInit.inst;
959 tmpPst.event = EVTNONE;
960 tmpPst.dstProcId = pst->srcProcId;
961 tmpPst.dstEnt = pst->srcEnt;
962 tmpPst.dstInst = pst->srcInst;
965 if(spId == rgCb[inst].crgSap.sapCfg.spId)
967 /* Check the state of the SAP */
968 switch (rgCb[inst].crgSap.sapSta.sapState)
970 case LRG_NOT_CFG: /* SAP Not configured */
972 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
973 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
974 LCM_CAUSE_INV_SAP, &dgn);
975 RLOG0(L_DEBUG,"SAP Not Configured");
976 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
978 case LRG_UNBND: /* SAP is not bound */
979 RLOG0(L_DEBUG,"SAP Not yet bound");
981 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
982 rgCb[inst].crgSap.sapCfg.suId = suId;
983 /* Send Bind Confirm with status as SUCCESS */
984 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
985 /* Indicate to Layer manager */
986 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
987 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
988 LCM_CAUSE_UNKNOWN, &dgn);
990 case LRG_BND: /* SAP is already bound*/
991 RLOG0(L_DEBUG,"SAP is already bound");
993 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
995 default: /* Should Never Enter here */
996 #if (ERRCLASS & ERRCLS_ADD_RES)
997 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
998 rgCb[inst].crgSap.sapSta.sapState);
1000 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1006 #if (ERRCLASS & ERRCLS_ADD_RES)
1007 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
1008 rgCb[inst].crgSap.sapCfg.spId);
1010 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1013 } /* RgUiCrgBndReq */
1017 * @brief API for unbind request from RRC towards MAC.
1021 * Function: RgUiCrgUbndReq
1023 * This API is invoked by RRC towards MAC to unbind CRG SAP.
1024 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
1027 * @param[in] Pst *pst
1028 * @param[in] SuId suId
1029 * @param[in] Reason reason
1042 S16 RgUiCrgUbndReq(pst, spId, reason)
1050 RG_IS_INST_VALID(pst->dstInst);
1051 inst = pst->dstInst - RG_INST_START;
1052 /* SAP Id validation */
1053 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1055 switch(rgCb[inst].crgSap.sapSta.sapState)
1057 case LRG_BND: /* SAP is already bound*/
1058 /* setting SAP state to UN BOUND */
1059 RLOG0(L_DEBUG, "SAP is already bound");
1061 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
1064 #if (ERRCLASS & ERRCLS_ADD_RES)
1065 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
1066 rgCb[inst].crgSap.sapSta.sapState);
1073 #if (ERRCLASS & ERRCLS_ADD_RES)
1074 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
1075 rgCb[inst].crgSap.sapCfg.spId);
1080 } /* RgUiCrgUbndReq */
1083 * @brief API for sending bind confirm from MAC to RRC
1087 * Function: rgUIMRgrBndCfm
1089 * This API is invoked to send bind confirm from MAC to RRC.
1090 * This API fills in Pst structure and SAP Ids and invokes
1091 * bind confirm API towards RRC.
1093 * @param[in] Inst inst
1094 * @param[in] SuId suId
1095 * @param[in] uint8_t status
1108 S16 rgUIMCrgBndCfm(inst,suId, status)
1115 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
1117 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
1122 } /* rgUIMCrgBndCfm*/
1125 * @brief API for configuration request from RRC towards MAC.
1129 * Function: RgUiCrgCfgReq
1131 * This API is invoked by RRC towards MAC to configure MAC.
1132 * These API validates the Pst, spId, suId and transfers the config request
1133 * specific information to corresponding ownership module (COM) API.
1136 * @param[in] Pst *pst
1137 * @param[in] SpId spId
1138 * @param[in] CrgCfgTransId transId
1139 * @param[in] CrgCfgReqInfo *cfgReqInfo
1149 CrgCfgTransId transId,
1150 CrgCfgReqInfo *cfgReqInfo
1153 S16 RgUiCrgCfgReq(pst, spId, transId, cfgReqInfo)
1156 CrgCfgTransId transId;
1157 CrgCfgReqInfo *cfgReqInfo;
1162 uint8_t cfmStatus = 0x00ff;
1163 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1165 RG_IS_INST_VALID(pst->dstInst);
1166 inst = pst->dstInst - RG_INST_START;
1167 /* Ensuring transId is always Null terminated. */
1168 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1169 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1172 /* CrgCfgReqInfo Validation for NULLP */
1173 if (cfgReqInfo == NULLP)
1175 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1176 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1180 /* Upper SAP Id and State validation */
1181 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1183 switch(rgCb[inst].crgSap.sapSta.sapState)
1185 case LRG_BND: /* SAP is already bound */
1186 RLOG0(L_DEBUG,"SAP is already bound");
1188 default: /* Should never reach here */
1189 #if (ERRCLASS & ERRCLS_ADD_RES)
1190 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1191 rgCb[inst].crgSap.sapSta.sapState);
1193 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1194 sizeof(CrgCfgReqInfo));
1197 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1203 #if (ERRCLASS & ERRCLS_ADD_RES)
1204 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1205 rgCb[inst].crgSap.sapCfg.spId);
1207 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1208 sizeof(CrgCfgReqInfo));
1210 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1213 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1214 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1215 sizeof(CrgCfgReqInfo));
1219 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1224 } /* RgUiCrgCfgReq */
1227 * @brief API for sending configuration confirm from MAC to RRC
1231 * Function: rgUIMCrgCfgCfm
1233 * This API is invoked to send configuration confirm from MAC to RRC.
1234 * This API fills in Pst structure and SAP Ids and invokes
1235 * config confirm API towards RRC.
1237 * @param[in] Inst inst
1238 * @param[in] CrgCfgTransId transId
1239 * @param[in] uint8_t status
1248 CrgCfgTransId transId,
1252 S16 rgUIMCrgCfgCfm(inst,transId, status)
1254 CrgCfgTransId transId;
1259 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1261 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1262 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1265 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1268 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1273 } /* rgUIMCrgCfgCfm */
1274 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1286 /* Read from Ring Buffer and process RLC BO Update */
1289 RguDStaRspInfo *staRsp;
1290 uint32_t elmIndx = 0;
1295 pst.dstEnt = ENTMAC;
1297 pst.srcEnt = ENTRLC;
1300 pst.route = RTESPEC;
1301 pst.event = EVTRGUDSTARSP;
1304 pst.selector = 2; /*SM_SELECTOR_LC */
1308 elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1309 while(NULLP != elmIndx)
1311 staRsp = (RguDStaRspInfo *)elmIndx;
1315 RgUiRguDStaRsp(&pst, spId, staRsp);
1319 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1321 if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1328 /**********************************************************************
1331 **********************************************************************/