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;
538 RG_IS_INST_VALID(pst->dstInst);
539 inst = pst->dstInst - RG_INST_START;
541 SStartTask(&startTime, PID_MAC_STA_RSP);
543 ret = rgROMDedStaRsp(inst,staRsp);
546 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
547 "Processing Of Status Response Failed");
552 SStopTask(startTime, PID_MAC_STA_RSP);
554 } /* RgUiRguDStaRsp */
558 * @brief Handler for common StaRsp from RGU
562 * Function : RgUiRguCStaRsp
564 * This function validates SAP and invokes ROM
565 * for further processing
568 * @param[in] Pst *pst
569 * @param[in] SpId spId
570 * @param[in] RguCStaRspInfo *staRsp
580 RguCStaRspInfo *staRsp
583 S16 RgUiRguCStaRsp(pst, spId, staRsp)
586 RguCStaRspInfo *staRsp;
592 RG_IS_INST_VALID(pst->dstInst);
593 inst = pst->dstInst - RG_INST_START;
597 RLOG0(L_ERROR,"Input Response Buffer is NULL");
601 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
603 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
605 case LRG_BND: /* SAP is bound */
606 RLOG0(L_DEBUG,"SAP is already bound");
608 default: /* Should never reach here */
609 #if (ERRCLASS & ERRCLS_ADD_RES)
610 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
611 rgCb[inst].rguSap[spId].sapSta.sapState);
618 #if (ERRCLASS & ERRCLS_ADD_RES)
619 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
625 ret = rgROMCmnStaRsp(inst,staRsp);
628 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
632 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
635 } /* RgUiRguCStaRsp */
640 * @brief Handler for L2M MeasReq from RGU
644 * Function :RgUiRguL2MUlThrpMeasReq
646 * This function validates SAP and invokes ROM for further processing
648 * @param[in] Pst *pst
649 * @param[in] SpId spId
650 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
656 S16 RgUiRguL2MUlThrpMeasReq
660 RguL2MUlThrpMeasReqInfo *measReq
663 S16 RgUiRguL2MUlThrpMeasReq(pst, spId, measReq)
666 RguL2MUlThrpMeasReqInfo *measReq;
673 RG_IS_INST_VALID(pst->dstInst);
674 inst = pst->dstInst - RG_INST_START;
676 if (measReq == NULLP)
678 RLOG0(L_ERROR,"Input Response Buffer is NULL");
682 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
684 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
686 case LRG_BND: /* SAP is bound */
687 RLOG0(L_DEBUG,"SAP is already bound");
689 default: /* Should never reach here */
690 #if (ERRCLASS & ERRCLS_ADD_RES)
691 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
692 rgCb[inst].rguSap[spId].sapSta.sapState);
699 #if (ERRCLASS & ERRCLS_ADD_RES)
700 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
706 ret = rgROML2MUlThrpMeasReq(inst,measReq);
709 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
712 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
715 } /* RgUiRguL2MUlThrpMeasReq */
719 * @brief Handler for sending staInd to dedicated logical channels of a UE
723 * Function : rgUIMSndDedStaInd
725 * This function fills SAP and Pst information to send the staInd to
729 * @param[in] Inst inst
730 * @param[in] RgUpSapCb *rguSap
731 * @param[in] RgRguDedStaInd *staInd
737 S16 rgUIMSndDedStaInd
741 RgRguDedStaInd *staInd
744 S16 rgUIMSndDedStaInd(inst,rguSap,staInd)
747 RgRguDedStaInd *staInd;
752 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
754 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
758 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
762 } /* rgUIMSndDedStaInd */
766 * @brief Handler for sending staInd to a common logical channel.
770 * Function : rgUIMSndCmnStaInd
772 * This function fills SAP and Pst information to send the staInd to
773 * a common logical channel.
776 * @param[in] Inst inst
777 * @param[in] RgUpSapCb *rguSap
778 * @param[in] RgRguCmnStaInd *staInd
784 S16 rgUIMSndCmnStaInd
788 RgRguCmnStaInd *staInd
791 S16 rgUIMSndCmnStaInd(inst,rguDlSap,staInd)
794 RgRguCmnStaInd *staInd;
799 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
803 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
807 } /* rgUIMSndCmnStaInd */
811 * @brief Handler for sending datInd to dedicated logical channels of a UE
815 * Function : rgUIMSndDedDatInd
817 * This function fills SAP and Pst information to send the datInd to
821 * @param[in] Inst inst
822 * @param[in] RgUpSapCb *rguUlSap
823 * @param[in] RgRguDedDatInd *datInd
829 S16 rgUIMSndDedDatInd
833 RgRguDedDatInd *datInd
836 S16 rgUIMSndDedDatInd(datInd)
839 RgRguDedDatInd *datInd;
844 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
846 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
850 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
854 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
855 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
858 } /* rgUIMSndDedDatInd */
862 * @brief Handler for sending datInd to a common logical channel.
866 * Function : rgUIMSndCmnDatInd
868 * This function fills SAP and Pst information to send the datInd to
869 * a common logical channel.
872 * @param[in] Inst inst
873 * @param[in] RgUpSapCb *rguSap
874 * @param[in] RgRguCmnDatInd *datInd
880 S16 rgUIMSndCmnDatInd
884 RgRguCmnDatInd *datInd
887 S16 rgUIMSndCmnDatInd(datInd)
890 RgRguCmnDatInd *datInd;
895 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
897 rguUlSap->sapSts.numPduTxmit++;
899 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
900 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
904 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
905 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
909 } /* rgUIMSndCmnDatInd */
913 * @brief API for bind request from RRC towards MAC.
917 * Function: RgUiCrgBndReq
919 * This API is invoked by RRC towards MAC to bind CRG SAP.
920 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
923 * @param[in] Pst *pst
924 * @param[in] SuId suId
925 * @param[in] SpId spId
938 S16 RgUiCrgBndReq(pst, suId, spId)
945 Pst tmpPst; /* Temporary Post Structure */
946 RgUstaDgn dgn; /* Alarm diagnostics structure */
949 RG_IS_INST_VALID(pst->dstInst);
950 inst = pst->dstInst - RG_INST_START;
952 tmpPst.prior = pst->prior;
953 tmpPst.route = pst->route;
954 tmpPst.selector = pst->selector;
955 tmpPst.region = rgCb[inst].rgInit.region;
956 tmpPst.pool = rgCb[inst].rgInit.pool;
957 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
958 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
959 tmpPst.srcInst = rgCb[inst].rgInit.inst;
960 tmpPst.event = EVTNONE;
961 tmpPst.dstProcId = pst->srcProcId;
962 tmpPst.dstEnt = pst->srcEnt;
963 tmpPst.dstInst = pst->srcInst;
966 if(spId == rgCb[inst].crgSap.sapCfg.spId)
968 /* Check the state of the SAP */
969 switch (rgCb[inst].crgSap.sapSta.sapState)
971 case LRG_NOT_CFG: /* SAP Not configured */
973 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
974 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
975 LCM_CAUSE_INV_SAP, &dgn);
976 RLOG0(L_DEBUG,"SAP Not Configured");
977 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
979 case LRG_UNBND: /* SAP is not bound */
980 RLOG0(L_DEBUG,"SAP Not yet bound");
982 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
983 rgCb[inst].crgSap.sapCfg.suId = suId;
984 /* Send Bind Confirm with status as SUCCESS */
985 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
986 /* Indicate to Layer manager */
987 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
988 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
989 LCM_CAUSE_UNKNOWN, &dgn);
991 case LRG_BND: /* SAP is already bound*/
992 RLOG0(L_DEBUG,"SAP is already bound");
994 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
996 default: /* Should Never Enter here */
997 #if (ERRCLASS & ERRCLS_ADD_RES)
998 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
999 rgCb[inst].crgSap.sapSta.sapState);
1001 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1007 #if (ERRCLASS & ERRCLS_ADD_RES)
1008 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
1009 rgCb[inst].crgSap.sapCfg.spId);
1011 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1014 } /* RgUiCrgBndReq */
1018 * @brief API for unbind request from RRC towards MAC.
1022 * Function: RgUiCrgUbndReq
1024 * This API is invoked by RRC towards MAC to unbind CRG SAP.
1025 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
1028 * @param[in] Pst *pst
1029 * @param[in] SuId suId
1030 * @param[in] Reason reason
1043 S16 RgUiCrgUbndReq(pst, spId, reason)
1051 RG_IS_INST_VALID(pst->dstInst);
1052 inst = pst->dstInst - RG_INST_START;
1053 /* SAP Id validation */
1054 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1056 switch(rgCb[inst].crgSap.sapSta.sapState)
1058 case LRG_BND: /* SAP is already bound*/
1059 /* setting SAP state to UN BOUND */
1060 RLOG0(L_DEBUG, "SAP is already bound");
1062 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
1065 #if (ERRCLASS & ERRCLS_ADD_RES)
1066 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
1067 rgCb[inst].crgSap.sapSta.sapState);
1074 #if (ERRCLASS & ERRCLS_ADD_RES)
1075 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
1076 rgCb[inst].crgSap.sapCfg.spId);
1081 } /* RgUiCrgUbndReq */
1084 * @brief API for sending bind confirm from MAC to RRC
1088 * Function: rgUIMRgrBndCfm
1090 * This API is invoked to send bind confirm from MAC to RRC.
1091 * This API fills in Pst structure and SAP Ids and invokes
1092 * bind confirm API towards RRC.
1094 * @param[in] Inst inst
1095 * @param[in] SuId suId
1096 * @param[in] uint8_t status
1109 S16 rgUIMCrgBndCfm(inst,suId, status)
1116 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
1118 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
1123 } /* rgUIMCrgBndCfm*/
1126 * @brief API for configuration request from RRC towards MAC.
1130 * Function: RgUiCrgCfgReq
1132 * This API is invoked by RRC towards MAC to configure MAC.
1133 * These API validates the Pst, spId, suId and transfers the config request
1134 * specific information to corresponding ownership module (COM) API.
1137 * @param[in] Pst *pst
1138 * @param[in] SpId spId
1139 * @param[in] CrgCfgTransId transId
1140 * @param[in] CrgCfgReqInfo *cfgReqInfo
1150 CrgCfgTransId transId,
1151 CrgCfgReqInfo *cfgReqInfo
1154 S16 RgUiCrgCfgReq(pst, spId, transId, cfgReqInfo)
1157 CrgCfgTransId transId;
1158 CrgCfgReqInfo *cfgReqInfo;
1163 uint8_t cfmStatus = 0x00ff;
1164 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1166 RG_IS_INST_VALID(pst->dstInst);
1167 inst = pst->dstInst - RG_INST_START;
1168 /* Ensuring transId is always Null terminated. */
1169 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1170 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1173 /* CrgCfgReqInfo Validation for NULLP */
1174 if (cfgReqInfo == NULLP)
1176 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1177 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1181 /* Upper SAP Id and State validation */
1182 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1184 switch(rgCb[inst].crgSap.sapSta.sapState)
1186 case LRG_BND: /* SAP is already bound */
1187 RLOG0(L_DEBUG,"SAP is already bound");
1189 default: /* Should never reach here */
1190 #if (ERRCLASS & ERRCLS_ADD_RES)
1191 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1192 rgCb[inst].crgSap.sapSta.sapState);
1194 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1195 sizeof(CrgCfgReqInfo));
1198 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1204 #if (ERRCLASS & ERRCLS_ADD_RES)
1205 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1206 rgCb[inst].crgSap.sapCfg.spId);
1208 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1209 sizeof(CrgCfgReqInfo));
1211 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1214 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1215 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1216 sizeof(CrgCfgReqInfo));
1220 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1225 } /* RgUiCrgCfgReq */
1228 * @brief API for sending configuration confirm from MAC to RRC
1232 * Function: rgUIMCrgCfgCfm
1234 * This API is invoked to send configuration confirm from MAC to RRC.
1235 * This API fills in Pst structure and SAP Ids and invokes
1236 * config confirm API towards RRC.
1238 * @param[in] Inst inst
1239 * @param[in] CrgCfgTransId transId
1240 * @param[in] uint8_t status
1249 CrgCfgTransId transId,
1253 S16 rgUIMCrgCfgCfm(inst,transId, status)
1255 CrgCfgTransId transId;
1260 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1262 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1263 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1266 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1269 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1274 } /* rgUIMCrgCfgCfm */
1275 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1287 /* Read from Ring Buffer and process RLC BO Update */
1290 RguDStaRspInfo *staRsp;
1291 uint32_t elmIndx = 0;
1296 pst.dstEnt = ENTMAC;
1298 pst.srcEnt = ENTRLC;
1301 pst.route = RTESPEC;
1302 pst.event = EVTRGUDSTARSP;
1305 pst.selector = 2; /*SM_SELECTOR_LC */
1309 elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1310 while(NULLP != elmIndx)
1312 staRsp = (RguDStaRspInfo *)elmIndx;
1316 RgUiRguDStaRsp(&pst, spId, staRsp);
1320 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1322 if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1329 /**********************************************************************
1332 **********************************************************************/