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 "envopt.h" /* environment options */
45 #include "envdep.h" /* environment dependent */
46 #include "envind.h" /* environment independent */
47 #include "gen.h" /* general layer */
48 #include "ssi.h" /* system services */
49 #include "cm5.h" /* common timers defines */
50 #include "cm_hash.h" /* common hash list defines */
51 #include "cm_llist.h" /* common linked list defines */
52 #include "cm_mblk.h" /* memory management */
53 #include "cm_tkns.h" /* common tokens */
55 #include "crg.h" /* CRG defines */
56 #include "lrg.h" /* layer management defines for LTE-MAC */
59 #include "rg_sch_inf.h"
60 #include "rg_env.h" /* customizable defines and macros for MAC */
61 #include "rg.h" /* defines and macros for MAC */
62 #include "rg_err.h" /* RG error defines */
64 /* header/extern include files (.x) */
66 #include "gen.x" /* general layer typedefs */
67 #include "ssi.x" /* system services typedefs */
68 #include "cm5.x" /* common timers */
69 #include "cm_hash.x" /* common hash list */
70 #include "cm_lib.x" /* common library */
71 #include "cm_llist.x" /* common linked list */
72 #include "cm_mblk.x" /* memory management */
73 #include "cm_tkns.x" /* common tokens */
75 #include "crg.x" /* CRG types */
76 #include "lrg.x" /* layer management typedefs for MAC */
79 #include "rg_sch_inf.x"
80 #include "rg_prg.x" /* PRG interface typedefs*/
81 #include "rg.x" /* typedefs for MAC */
92 /* forward references */
94 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
95 PUBLIC S16 rgBatchProc(Void);
100 * @brief Handler for Bind request.
104 * Function : RgUiRguBndReq
106 * This function handles the bind request from MAC Service User.
109 * @param[in] Pst *pst
110 * @param[in] SuId suId
111 * @param[in] SpId spId
117 PUBLIC S16 RgUiRguBndReq
124 PUBLIC S16 RgUiRguBndReq(pst, suId, spId)
132 Pst tmpPst; /* Temporary Post Structure */
133 RgUstaDgn dgn; /* Alarm diagnostics structure */
138 RG_IS_INST_VALID(pst->dstInst);
139 inst = pst->dstInst - RG_INST_START;
141 tmpPst.prior = pst->prior;
142 tmpPst.route = pst->route;
143 tmpPst.selector = pst->selector;
144 tmpPst.region = rgCb[inst].rgInit.region;
145 tmpPst.pool = rgCb[inst].rgInit.pool;
146 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
147 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
148 tmpPst.srcInst = rgCb[inst].rgInit.inst;
149 tmpPst.event = EVTNONE;
150 tmpPst.dstProcId = pst->srcProcId;
151 tmpPst.dstEnt = pst->srcEnt;
152 tmpPst.dstInst = pst->srcInst;
154 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
156 /* Check the state of the SAP */
157 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
159 case LRG_NOT_CFG: /* SAP Not configured */
160 RGDBGINFO(inst,(rgPBuf(inst), "SAP Not Configured\n"));
161 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
162 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
163 LCM_CAUSE_INV_SAP, &dgn);
164 RLOG0(L_DEBUG,"SAP Not Configured");
165 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
167 case LRG_UNBND: /* SAP is not bound */
168 RLOG0(L_DEBUG,"SAP Not yet bound");
169 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
170 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
171 /* Send Bind Confirm with status as SUCCESS */
172 /*T2K - Passing spId as it is required to access the SAP CB*/
173 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
174 /* Indicate to Layer manager */
175 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
176 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
177 LCM_CAUSE_UNKNOWN, &dgn);
179 case LRG_BND: /* SAP is already bound*/
180 RLOG0(L_DEBUG,"SAP already bound");
181 /*T2K - Passing spId as it is required to access the SAP CB*/
182 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
184 default: /* Should Never Enter here */
185 #if (ERRCLASS & ERRCLS_ADD_RES)
186 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG008, (ErrVal)rgCb[inst].rguSap[spId].sapSta.sapState,
187 "Invalid SAP State:RgUiRguBndReq failed\n");
189 /*T2K - Passing spId as it is required to access the SAP CB*/
190 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
196 #if (ERRCLASS & ERRCLS_ADD_RES)
197 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG009, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
198 "Invalid SAP Id:RgUiRguBndReq failed\n");
200 /*T2K - Passing spId as it is required to access the SAP CB*/
201 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
204 } /* RgUiRguBndReq */
208 * @brief Handler for Unbind request.
212 * Function : RgUiRguUbndReq
214 * This function handles the unbind request from MAC Service User.
217 * @param[in] Pst *pst
218 * @param[in] SpId spId
219 * @param[in] Reason reason
225 PUBLIC S16 RgUiRguUbndReq
232 PUBLIC S16 RgUiRguUbndReq(pst, spId, reason)
242 RG_IS_INST_VALID(pst->dstInst);
243 inst = pst->dstInst - RG_INST_START;
244 /* SAP Id validation */
245 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
247 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
249 case LRG_BND: /* SAP is already bound*/
250 RLOG0(L_DEBUG,"SAP already bound");
251 /* setting SAP state to UN BOUND */
252 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
255 #if (ERRCLASS & ERRCLS_ADD_RES)
256 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguUbndReq failed",
257 rgCb[inst].rguSap[spId].sapSta.sapState);
265 #if (ERRCLASS & ERRCLS_ADD_RES)
266 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG011, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
267 "Invalid SAP Id:RgUiRguUbndReq failed\n");
272 } /* RgUiRguUbndReq */
274 * @brief API for sending bind confirm from MAC to RLC
278 * Function: rgUIMRguBndCfm
280 * This API is invoked to send bind confirm from MAC to RLC.
281 * This API fills in Pst structure and SAP Ids and invokes
282 * bind confirm API towards RLC.
284 * @param[in] Inst inst
285 * @param[in] SuId suId
286 * @param[in] U8 status
292 PUBLIC S16 rgUIMRguBndCfm
299 PUBLIC S16 rgUIMRguBndCfm(inst,spId, status)
310 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
311 rgCb[inst].rguSap[spId].sapCfg.suId, status);
315 RLOG0(L_ERROR,"RgUiRguBndCfm Failed ");
319 } /* rgUIMRguBndCfm*/
323 * @brief Handler for dedicated DatReq from RGU
327 * Function : RgUiRguDDatReq
329 * This function validates SAP and invokes ROM for further processing
331 * @param[in] Pst *pst
332 * @param[in] SpId spId
333 * @param[in] RguDDatReqInfo *datReq
339 PUBLIC S16 RgUiRguDDatReq
343 RguDDatReqInfo *datReq
346 PUBLIC S16 RgUiRguDDatReq(pst, spId, datReq)
349 RguDDatReqInfo *datReq;
364 RG_IS_INST_VALID(pst->dstInst);
365 inst = pst->dstInst - RG_INST_START;
369 RLOG0(L_ERROR,"Input Message Buffer is NULL");
373 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
375 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
377 case LRG_BND: /* SAP is bound */
378 RLOG0(L_DEBUG,"SAP is already bound");
380 default: /* Should never reach here */
381 #if (ERRCLASS & ERRCLS_ADD_RES)
382 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguDDatReq failed",
383 rgCb[inst].rguSap[spId].sapSta.sapState);
386 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
388 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
396 #if (ERRCLASS & ERRCLS_ADD_RES)
397 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG013, (ErrVal)spId,
398 "Invalid SAP Id:RgUiRguDDatReq failed\n");
401 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
403 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
409 /* Update RGU SAP statistics for received sdu count */
410 /*ccpu00118201 - ADD - Send trace only when its enabled*/
411 if(rgCb[inst].rgInit.trc)
413 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
415 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
416 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
418 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
420 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
421 * rgROMDedDatReq -> rgUpdtRguDedSts function
422 * So numPduRcvd updation is commented here */
423 /* rgCb.rguSap.sapSts.numPduRcvd +=
424 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
425 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
427 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
428 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
436 /* Call Ownership module for further processing */
437 ret = rgROMDedDatReq(inst,datReq);
438 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
441 } /* RgUiRguDDatReq */
445 * @brief Handler for common DatReq from RGU
449 * Function : RgUiRguCDatReq
451 * This function validates SAP invokes ROM for further processing
453 * @param[in] Pst *pst
454 * @param[in] SpId spId
455 * @param[in] RguCDatReqInfo *datReq
461 PUBLIC S16 RgUiRguCDatReq
465 RguCDatReqInfo *datReq
468 PUBLIC S16 RgUiRguCDatReq(pst, spId, datReq)
471 RguCDatReqInfo *datReq;
480 RG_IS_INST_VALID(pst->dstInst);
481 inst = pst->dstInst - RG_INST_START;
485 RLOG0(L_ERROR,"Input Message Buffer is NULL");
489 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
491 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
493 case LRG_BND: /* SAP is bound */
494 RLOG0(L_DEBUG,"SAP is already bound");
496 default: /* Should never reach here */
497 #if (ERRCLASS & ERRCLS_ADD_RES)
498 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCDatReq failed",
499 rgCb[inst].rguSap[spId].sapSta.sapState);
506 #if (ERRCLASS & ERRCLS_ADD_RES)
507 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
513 /* Update RGU SAP statistics for received sdu count */
514 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
515 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
516 * So numPduRcvd updation is commented here */
517 /* rgCb.rguSap.sapSts.numPduRcvd++; */
519 ret = rgROMCmnDatReq(inst,datReq);
520 /*ccpu00118201 - ADD - Send trace only when its enabled*/
521 if(rgCb[inst].rgInit.trc)
523 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
527 RG_DROP_RGUCDATREQ_MBUF(datReq);
529 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
532 } /* RgUiRguCDatReq */
536 * @brief Handler for dedicated StaRsp from RGU
540 * Function : RgUiRguDStaRsp
542 * This function validates SAP and invokes ROM for further processing
544 * @param[in] Pst *pst
545 * @param[in] SpId spId
546 * @param[in] RguDStaRspInfo *staRsp
552 PUBLIC S16 RgUiRguDStaRsp
556 RguDStaRspInfo *staRsp
559 PUBLIC S16 RgUiRguDStaRsp(pst, spId, staRsp)
562 RguDStaRspInfo *staRsp;
568 VOLATILE U32 startTime = 0;
572 RG_IS_INST_VALID(pst->dstInst);
573 inst = pst->dstInst - RG_INST_START;
575 SStartTask(&startTime, PID_MAC_STA_RSP);
577 ret = rgROMDedStaRsp(inst,staRsp);
580 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
581 "Processing Of Status Response Failed");
586 SStopTask(startTime, PID_MAC_STA_RSP);
588 } /* RgUiRguDStaRsp */
592 * @brief Handler for common StaRsp from RGU
596 * Function : RgUiRguCStaRsp
598 * This function validates SAP and invokes ROM
599 * for further processing
602 * @param[in] Pst *pst
603 * @param[in] SpId spId
604 * @param[in] RguCStaRspInfo *staRsp
610 PUBLIC S16 RgUiRguCStaRsp
614 RguCStaRspInfo *staRsp
617 PUBLIC S16 RgUiRguCStaRsp(pst, spId, staRsp)
620 RguCStaRspInfo *staRsp;
629 RG_IS_INST_VALID(pst->dstInst);
630 inst = pst->dstInst - RG_INST_START;
634 RLOG0(L_ERROR,"Input Response Buffer is NULL");
638 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
640 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
642 case LRG_BND: /* SAP is bound */
643 RLOG0(L_DEBUG,"SAP is already bound");
645 default: /* Should never reach here */
646 #if (ERRCLASS & ERRCLS_ADD_RES)
647 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
648 rgCb[inst].rguSap[spId].sapSta.sapState);
655 #if (ERRCLASS & ERRCLS_ADD_RES)
656 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
662 ret = rgROMCmnStaRsp(inst,staRsp);
665 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
669 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
672 } /* RgUiRguCStaRsp */
677 * @brief Handler for L2M MeasReq from RGU
681 * Function :RgUiRguL2MUlThrpMeasReq
683 * This function validates SAP and invokes ROM for further processing
685 * @param[in] Pst *pst
686 * @param[in] SpId spId
687 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
693 PUBLIC S16 RgUiRguL2MUlThrpMeasReq
697 RguL2MUlThrpMeasReqInfo *measReq
700 PUBLIC S16 RgUiRguL2MUlThrpMeasReq(pst, spId, measReq)
703 RguL2MUlThrpMeasReqInfo *measReq;
710 TRC3(RgUiRguL2MUlThrpMeasReq)
713 RG_IS_INST_VALID(pst->dstInst);
714 inst = pst->dstInst - RG_INST_START;
716 if (measReq == NULLP)
718 RLOG0(L_ERROR,"Input Response Buffer is NULL");
722 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
724 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
726 case LRG_BND: /* SAP is bound */
727 RLOG0(L_DEBUG,"SAP is already bound");
729 default: /* Should never reach here */
730 #if (ERRCLASS & ERRCLS_ADD_RES)
731 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
732 rgCb[inst].rguSap[spId].sapSta.sapState);
739 #if (ERRCLASS & ERRCLS_ADD_RES)
740 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
746 ret = rgROML2MUlThrpMeasReq(inst,measReq);
749 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
752 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
755 } /* RgUiRguL2MUlThrpMeasReq */
759 * @brief Handler for sending staInd to dedicated logical channels of a UE
763 * Function : rgUIMSndDedStaInd
765 * This function fills SAP and Pst information to send the staInd to
769 * @param[in] Inst inst
770 * @param[in] RgUpSapCb *rguSap
771 * @param[in] RgRguDedStaInd *staInd
777 PUBLIC S16 rgUIMSndDedStaInd
781 RgRguDedStaInd *staInd
784 PUBLIC S16 rgUIMSndDedStaInd(inst,rguSap,staInd)
787 RgRguDedStaInd *staInd;
792 TRC2(rgUIMSndDedStaInd)
794 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
796 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
800 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
804 } /* rgUIMSndDedStaInd */
808 * @brief Handler for sending staInd to a common logical channel.
812 * Function : rgUIMSndCmnStaInd
814 * This function fills SAP and Pst information to send the staInd to
815 * a common logical channel.
818 * @param[in] Inst inst
819 * @param[in] RgUpSapCb *rguSap
820 * @param[in] RgRguCmnStaInd *staInd
826 PUBLIC S16 rgUIMSndCmnStaInd
830 RgRguCmnStaInd *staInd
833 PUBLIC S16 rgUIMSndCmnStaInd(inst,rguDlSap,staInd)
836 RgRguCmnStaInd *staInd;
842 TRC2(rgUIMSndCmnStaInd)
845 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
849 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
853 } /* rgUIMSndCmnStaInd */
857 * @brief Handler for sending datInd to dedicated logical channels of a UE
861 * Function : rgUIMSndDedDatInd
863 * This function fills SAP and Pst information to send the datInd to
867 * @param[in] Inst inst
868 * @param[in] RgUpSapCb *rguUlSap
869 * @param[in] RgRguDedDatInd *datInd
875 PUBLIC S16 rgUIMSndDedDatInd
879 RgRguDedDatInd *datInd
882 PUBLIC S16 rgUIMSndDedDatInd(datInd)
885 RgRguDedDatInd *datInd;
891 TRC2(rgUIMSndDedDatInd)
894 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
896 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
900 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
904 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
905 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
908 } /* rgUIMSndDedDatInd */
912 * @brief Handler for sending datInd to a common logical channel.
916 * Function : rgUIMSndCmnDatInd
918 * This function fills SAP and Pst information to send the datInd to
919 * a common logical channel.
922 * @param[in] Inst inst
923 * @param[in] RgUpSapCb *rguSap
924 * @param[in] RgRguCmnDatInd *datInd
930 PUBLIC S16 rgUIMSndCmnDatInd
934 RgRguCmnDatInd *datInd
937 PUBLIC S16 rgUIMSndCmnDatInd(datInd)
940 RgRguCmnDatInd *datInd;
945 TRC2(rgUIMSndCmnDatInd)
948 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
950 rguUlSap->sapSts.numPduTxmit++;
952 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
953 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
957 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
958 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
962 } /* rgUIMSndCmnDatInd */
966 * @brief API for bind request from RRC towards MAC.
970 * Function: RgUiCrgBndReq
972 * This API is invoked by RRC towards MAC to bind CRG SAP.
973 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
976 * @param[in] Pst *pst
977 * @param[in] SuId suId
978 * @param[in] SpId spId
984 PUBLIC S16 RgUiCrgBndReq
991 PUBLIC S16 RgUiCrgBndReq(pst, suId, spId)
998 Pst tmpPst; /* Temporary Post Structure */
999 RgUstaDgn dgn; /* Alarm diagnostics structure */
1005 RG_IS_INST_VALID(pst->dstInst);
1006 inst = pst->dstInst - RG_INST_START;
1008 tmpPst.prior = pst->prior;
1009 tmpPst.route = pst->route;
1010 tmpPst.selector = pst->selector;
1011 tmpPst.region = rgCb[inst].rgInit.region;
1012 tmpPst.pool = rgCb[inst].rgInit.pool;
1013 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
1014 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
1015 tmpPst.srcInst = rgCb[inst].rgInit.inst;
1016 tmpPst.event = EVTNONE;
1017 tmpPst.dstProcId = pst->srcProcId;
1018 tmpPst.dstEnt = pst->srcEnt;
1019 tmpPst.dstInst = pst->srcInst;
1022 if(spId == rgCb[inst].crgSap.sapCfg.spId)
1024 /* Check the state of the SAP */
1025 switch (rgCb[inst].crgSap.sapSta.sapState)
1027 case LRG_NOT_CFG: /* SAP Not configured */
1029 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1030 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
1031 LCM_CAUSE_INV_SAP, &dgn);
1032 RLOG0(L_DEBUG,"SAP Not Configured");
1033 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
1035 case LRG_UNBND: /* SAP is not bound */
1036 RLOG0(L_DEBUG,"SAP Not yet bound");
1038 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
1039 rgCb[inst].crgSap.sapCfg.suId = suId;
1040 /* Send Bind Confirm with status as SUCCESS */
1041 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1042 /* Indicate to Layer manager */
1043 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1044 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
1045 LCM_CAUSE_UNKNOWN, &dgn);
1047 case LRG_BND: /* SAP is already bound*/
1048 RLOG0(L_DEBUG,"SAP is already bound");
1050 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1052 default: /* Should Never Enter here */
1053 #if (ERRCLASS & ERRCLS_ADD_RES)
1054 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
1055 rgCb[inst].crgSap.sapSta.sapState);
1057 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1063 #if (ERRCLASS & ERRCLS_ADD_RES)
1064 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
1065 rgCb[inst].crgSap.sapCfg.spId);
1067 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1070 } /* RgUiCrgBndReq */
1074 * @brief API for unbind request from RRC towards MAC.
1078 * Function: RgUiCrgUbndReq
1080 * This API is invoked by RRC towards MAC to unbind CRG SAP.
1081 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
1084 * @param[in] Pst *pst
1085 * @param[in] SuId suId
1086 * @param[in] Reason reason
1092 PUBLIC S16 RgUiCrgUbndReq
1099 PUBLIC S16 RgUiCrgUbndReq(pst, spId, reason)
1106 TRC3(RgUiCrgUbndReq)
1109 RG_IS_INST_VALID(pst->dstInst);
1110 inst = pst->dstInst - RG_INST_START;
1111 /* SAP Id validation */
1112 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1114 switch(rgCb[inst].crgSap.sapSta.sapState)
1116 case LRG_BND: /* SAP is already bound*/
1117 /* setting SAP state to UN BOUND */
1118 RLOG0(L_DEBUG, "SAP is already bound");
1120 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
1123 #if (ERRCLASS & ERRCLS_ADD_RES)
1124 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
1125 rgCb[inst].crgSap.sapSta.sapState);
1132 #if (ERRCLASS & ERRCLS_ADD_RES)
1133 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
1134 rgCb[inst].crgSap.sapCfg.spId);
1139 } /* RgUiCrgUbndReq */
1142 * @brief API for sending bind confirm from MAC to RRC
1146 * Function: rgUIMRgrBndCfm
1148 * This API is invoked to send bind confirm from MAC to RRC.
1149 * This API fills in Pst structure and SAP Ids and invokes
1150 * bind confirm API towards RRC.
1152 * @param[in] Inst inst
1153 * @param[in] SuId suId
1154 * @param[in] U8 status
1160 PUBLIC S16 rgUIMCrgBndCfm
1167 PUBLIC S16 rgUIMCrgBndCfm(inst,suId, status)
1173 TRC2(rgUIMCrgBndCfm)
1176 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
1178 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
1183 } /* rgUIMCrgBndCfm*/
1186 * @brief API for configuration request from RRC towards MAC.
1190 * Function: RgUiCrgCfgReq
1192 * This API is invoked by RRC towards MAC to configure MAC.
1193 * These API validates the Pst, spId, suId and transfers the config request
1194 * specific information to corresponding ownership module (COM) API.
1197 * @param[in] Pst *pst
1198 * @param[in] SpId spId
1199 * @param[in] CrgCfgTransId transId
1200 * @param[in] CrgCfgReqInfo *cfgReqInfo
1206 PUBLIC S16 RgUiCrgCfgReq
1210 CrgCfgTransId transId,
1211 CrgCfgReqInfo *cfgReqInfo
1214 PUBLIC S16 RgUiCrgCfgReq(pst, spId, transId, cfgReqInfo)
1217 CrgCfgTransId transId;
1218 CrgCfgReqInfo *cfgReqInfo;
1223 U8 cfmStatus = 0x00ff;
1224 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1226 TRC3(RgUiCrgCfgReq);
1228 RG_IS_INST_VALID(pst->dstInst);
1229 inst = pst->dstInst - RG_INST_START;
1230 /* Ensuring transId is always Null terminated. */
1231 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1232 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1235 /* CrgCfgReqInfo Validation for NULLP */
1236 if (cfgReqInfo == NULLP)
1238 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1239 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1243 /* Upper SAP Id and State validation */
1244 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1246 switch(rgCb[inst].crgSap.sapSta.sapState)
1248 case LRG_BND: /* SAP is already bound */
1249 RLOG0(L_DEBUG,"SAP is already bound");
1251 default: /* Should never reach here */
1252 #if (ERRCLASS & ERRCLS_ADD_RES)
1253 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1254 rgCb[inst].crgSap.sapSta.sapState);
1256 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1257 sizeof(CrgCfgReqInfo));
1260 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1266 #if (ERRCLASS & ERRCLS_ADD_RES)
1267 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1268 rgCb[inst].crgSap.sapCfg.spId);
1270 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1271 sizeof(CrgCfgReqInfo));
1273 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1276 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1277 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1278 sizeof(CrgCfgReqInfo));
1282 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1287 } /* RgUiCrgCfgReq */
1290 * @brief API for sending configuration confirm from MAC to RRC
1294 * Function: rgUIMCrgCfgCfm
1296 * This API is invoked to send configuration confirm from MAC to RRC.
1297 * This API fills in Pst structure and SAP Ids and invokes
1298 * config confirm API towards RRC.
1300 * @param[in] Inst inst
1301 * @param[in] CrgCfgTransId transId
1302 * @param[in] U8 status
1308 PUBLIC S16 rgUIMCrgCfgCfm
1311 CrgCfgTransId transId,
1315 PUBLIC S16 rgUIMCrgCfgCfm(inst,transId, status)
1317 CrgCfgTransId transId;
1322 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1324 TRC2(rgUIMCrgCfgCfm)
1326 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1327 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1330 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1333 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1338 } /* rgUIMCrgCfgCfm */
1339 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1342 PUBLIC S16 rgBatchProc
1347 PUBLIC S16 rgBatchProc()
1351 /* Read from Ring Buffer and process RLC BO Update */
1354 RguDStaRspInfo *staRsp;
1365 pst.route = RTESPEC;
1366 pst.event = EVTRGUDSTARSP;
1369 pst.selector = 2; /*SM_SELECTOR_LC */
1373 elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1374 while(NULLP != elmIndx)
1376 staRsp = (RguDStaRspInfo *)elmIndx;
1380 RgUiRguDStaRsp(&pst, spId, staRsp);
1384 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1386 if((elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1393 /**********************************************************************
1396 **********************************************************************/