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 "du_app_mac_inf.h"
82 #include "rg.x" /* typedefs for MAC */
93 /* forward references */
95 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
96 PUBLIC S16 rgBatchProc(Void);
101 * @brief Handler for Bind request.
105 * Function : RgUiRguBndReq
107 * This function handles the bind request from MAC Service User.
110 * @param[in] Pst *pst
111 * @param[in] SuId suId
112 * @param[in] SpId spId
118 PUBLIC S16 RgUiRguBndReq
125 PUBLIC S16 RgUiRguBndReq(pst, suId, spId)
133 Pst tmpPst; /* Temporary Post Structure */
134 RgUstaDgn dgn; /* Alarm diagnostics structure */
139 RG_IS_INST_VALID(pst->dstInst);
140 inst = pst->dstInst - RG_INST_START;
142 tmpPst.prior = pst->prior;
143 tmpPst.route = pst->route;
144 tmpPst.selector = pst->selector;
145 tmpPst.region = rgCb[inst].rgInit.region;
146 tmpPst.pool = rgCb[inst].rgInit.pool;
147 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
148 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
149 tmpPst.srcInst = rgCb[inst].rgInit.inst;
150 tmpPst.event = EVTNONE;
151 tmpPst.dstProcId = pst->srcProcId;
152 tmpPst.dstEnt = pst->srcEnt;
153 tmpPst.dstInst = pst->srcInst;
155 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
157 /* Check the state of the SAP */
158 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
160 case LRG_NOT_CFG: /* SAP Not configured */
161 RGDBGINFO(inst,(rgPBuf(inst), "SAP Not Configured\n"));
162 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
163 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
164 LCM_CAUSE_INV_SAP, &dgn);
165 RLOG0(L_DEBUG,"SAP Not Configured");
166 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
168 case LRG_UNBND: /* SAP is not bound */
169 RLOG0(L_DEBUG,"SAP Not yet bound");
170 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
171 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
172 /* Send Bind Confirm with status as SUCCESS */
173 /*T2K - Passing spId as it is required to access the SAP CB*/
174 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
175 /* Indicate to Layer manager */
176 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
177 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
178 LCM_CAUSE_UNKNOWN, &dgn);
180 case LRG_BND: /* SAP is already bound*/
181 RLOG0(L_DEBUG,"SAP already bound");
182 /*T2K - Passing spId as it is required to access the SAP CB*/
183 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
185 default: /* Should Never Enter here */
186 #if (ERRCLASS & ERRCLS_ADD_RES)
187 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG008, (ErrVal)rgCb[inst].rguSap[spId].sapSta.sapState,
188 "Invalid SAP State:RgUiRguBndReq failed\n");
190 /*T2K - Passing spId as it is required to access the SAP CB*/
191 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
197 #if (ERRCLASS & ERRCLS_ADD_RES)
198 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG009, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
199 "Invalid SAP Id:RgUiRguBndReq failed\n");
201 /*T2K - Passing spId as it is required to access the SAP CB*/
202 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
205 } /* RgUiRguBndReq */
209 * @brief Handler for Unbind request.
213 * Function : RgUiRguUbndReq
215 * This function handles the unbind request from MAC Service User.
218 * @param[in] Pst *pst
219 * @param[in] SpId spId
220 * @param[in] Reason reason
226 PUBLIC S16 RgUiRguUbndReq
233 PUBLIC S16 RgUiRguUbndReq(pst, spId, reason)
243 RG_IS_INST_VALID(pst->dstInst);
244 inst = pst->dstInst - RG_INST_START;
245 /* SAP Id validation */
246 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
248 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
250 case LRG_BND: /* SAP is already bound*/
251 RLOG0(L_DEBUG,"SAP already bound");
252 /* setting SAP state to UN BOUND */
253 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
256 #if (ERRCLASS & ERRCLS_ADD_RES)
257 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguUbndReq failed",
258 rgCb[inst].rguSap[spId].sapSta.sapState);
266 #if (ERRCLASS & ERRCLS_ADD_RES)
267 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG011, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
268 "Invalid SAP Id:RgUiRguUbndReq failed\n");
273 } /* RgUiRguUbndReq */
275 * @brief API for sending bind confirm from MAC to RLC
279 * Function: rgUIMRguBndCfm
281 * This API is invoked to send bind confirm from MAC to RLC.
282 * This API fills in Pst structure and SAP Ids and invokes
283 * bind confirm API towards RLC.
285 * @param[in] Inst inst
286 * @param[in] SuId suId
287 * @param[in] U8 status
293 PUBLIC S16 rgUIMRguBndCfm
300 PUBLIC S16 rgUIMRguBndCfm(inst,spId, status)
311 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
312 rgCb[inst].rguSap[spId].sapCfg.suId, status);
316 RLOG0(L_ERROR,"RgUiRguBndCfm Failed ");
320 } /* rgUIMRguBndCfm*/
324 * @brief Handler for dedicated DatReq from RGU
328 * Function : RgUiRguDDatReq
330 * This function validates SAP and invokes ROM for further processing
332 * @param[in] Pst *pst
333 * @param[in] SpId spId
334 * @param[in] RguDDatReqInfo *datReq
340 PUBLIC S16 RgUiRguDDatReq
344 RguDDatReqInfo *datReq
347 PUBLIC S16 RgUiRguDDatReq(pst, spId, datReq)
350 RguDDatReqInfo *datReq;
365 RG_IS_INST_VALID(pst->dstInst);
366 inst = pst->dstInst - RG_INST_START;
370 RLOG0(L_ERROR,"Input Message Buffer is NULL");
374 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
376 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
378 case LRG_BND: /* SAP is bound */
379 RLOG0(L_DEBUG,"SAP is already bound");
381 default: /* Should never reach here */
382 #if (ERRCLASS & ERRCLS_ADD_RES)
383 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguDDatReq failed",
384 rgCb[inst].rguSap[spId].sapSta.sapState);
387 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
389 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
397 #if (ERRCLASS & ERRCLS_ADD_RES)
398 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG013, (ErrVal)spId,
399 "Invalid SAP Id:RgUiRguDDatReq failed\n");
402 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
404 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
410 /* Update RGU SAP statistics for received sdu count */
411 /*ccpu00118201 - ADD - Send trace only when its enabled*/
412 if(rgCb[inst].rgInit.trc)
414 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
416 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
417 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
419 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
421 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
422 * rgROMDedDatReq -> rgUpdtRguDedSts function
423 * So numPduRcvd updation is commented here */
424 /* rgCb.rguSap.sapSts.numPduRcvd +=
425 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
426 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
428 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
429 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
437 /* Call Ownership module for further processing */
438 ret = rgROMDedDatReq(inst,datReq);
439 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
442 } /* RgUiRguDDatReq */
446 * @brief Handler for common DatReq from RGU
450 * Function : RgUiRguCDatReq
452 * This function validates SAP invokes ROM for further processing
454 * @param[in] Pst *pst
455 * @param[in] SpId spId
456 * @param[in] RguCDatReqInfo *datReq
462 PUBLIC S16 RgUiRguCDatReq
466 RguCDatReqInfo *datReq
469 PUBLIC S16 RgUiRguCDatReq(pst, spId, datReq)
472 RguCDatReqInfo *datReq;
481 RG_IS_INST_VALID(pst->dstInst);
482 inst = pst->dstInst - RG_INST_START;
486 RLOG0(L_ERROR,"Input Message Buffer is NULL");
490 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
492 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
494 case LRG_BND: /* SAP is bound */
495 RLOG0(L_DEBUG,"SAP is already bound");
497 default: /* Should never reach here */
498 #if (ERRCLASS & ERRCLS_ADD_RES)
499 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCDatReq failed",
500 rgCb[inst].rguSap[spId].sapSta.sapState);
507 #if (ERRCLASS & ERRCLS_ADD_RES)
508 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
514 /* Update RGU SAP statistics for received sdu count */
515 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
516 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
517 * So numPduRcvd updation is commented here */
518 /* rgCb.rguSap.sapSts.numPduRcvd++; */
520 ret = rgROMCmnDatReq(inst,datReq);
521 /*ccpu00118201 - ADD - Send trace only when its enabled*/
522 if(rgCb[inst].rgInit.trc)
524 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
528 RG_DROP_RGUCDATREQ_MBUF(datReq);
530 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
533 } /* RgUiRguCDatReq */
537 * @brief Handler for dedicated StaRsp from RGU
541 * Function : RgUiRguDStaRsp
543 * This function validates SAP and invokes ROM for further processing
545 * @param[in] Pst *pst
546 * @param[in] SpId spId
547 * @param[in] RguDStaRspInfo *staRsp
553 PUBLIC S16 RgUiRguDStaRsp
557 RguDStaRspInfo *staRsp
560 PUBLIC S16 RgUiRguDStaRsp(pst, spId, staRsp)
563 RguDStaRspInfo *staRsp;
569 VOLATILE U32 startTime = 0;
573 RG_IS_INST_VALID(pst->dstInst);
574 inst = pst->dstInst - RG_INST_START;
576 SStartTask(&startTime, PID_MAC_STA_RSP);
578 ret = rgROMDedStaRsp(inst,staRsp);
581 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
582 "Processing Of Status Response Failed");
587 SStopTask(startTime, PID_MAC_STA_RSP);
589 } /* RgUiRguDStaRsp */
593 * @brief Handler for common StaRsp from RGU
597 * Function : RgUiRguCStaRsp
599 * This function validates SAP and invokes ROM
600 * for further processing
603 * @param[in] Pst *pst
604 * @param[in] SpId spId
605 * @param[in] RguCStaRspInfo *staRsp
611 PUBLIC S16 RgUiRguCStaRsp
615 RguCStaRspInfo *staRsp
618 PUBLIC S16 RgUiRguCStaRsp(pst, spId, staRsp)
621 RguCStaRspInfo *staRsp;
630 RG_IS_INST_VALID(pst->dstInst);
631 inst = pst->dstInst - RG_INST_START;
635 RLOG0(L_ERROR,"Input Response Buffer is NULL");
639 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
641 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
643 case LRG_BND: /* SAP is bound */
644 RLOG0(L_DEBUG,"SAP is already bound");
646 default: /* Should never reach here */
647 #if (ERRCLASS & ERRCLS_ADD_RES)
648 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
649 rgCb[inst].rguSap[spId].sapSta.sapState);
656 #if (ERRCLASS & ERRCLS_ADD_RES)
657 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
663 ret = rgROMCmnStaRsp(inst,staRsp);
666 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
670 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
673 } /* RgUiRguCStaRsp */
678 * @brief Handler for L2M MeasReq from RGU
682 * Function :RgUiRguL2MUlThrpMeasReq
684 * This function validates SAP and invokes ROM for further processing
686 * @param[in] Pst *pst
687 * @param[in] SpId spId
688 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
694 PUBLIC S16 RgUiRguL2MUlThrpMeasReq
698 RguL2MUlThrpMeasReqInfo *measReq
701 PUBLIC S16 RgUiRguL2MUlThrpMeasReq(pst, spId, measReq)
704 RguL2MUlThrpMeasReqInfo *measReq;
711 TRC3(RgUiRguL2MUlThrpMeasReq)
714 RG_IS_INST_VALID(pst->dstInst);
715 inst = pst->dstInst - RG_INST_START;
717 if (measReq == NULLP)
719 RLOG0(L_ERROR,"Input Response Buffer is NULL");
723 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
725 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
727 case LRG_BND: /* SAP is bound */
728 RLOG0(L_DEBUG,"SAP is already bound");
730 default: /* Should never reach here */
731 #if (ERRCLASS & ERRCLS_ADD_RES)
732 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
733 rgCb[inst].rguSap[spId].sapSta.sapState);
740 #if (ERRCLASS & ERRCLS_ADD_RES)
741 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
747 ret = rgROML2MUlThrpMeasReq(inst,measReq);
750 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
753 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
756 } /* RgUiRguL2MUlThrpMeasReq */
760 * @brief Handler for sending staInd to dedicated logical channels of a UE
764 * Function : rgUIMSndDedStaInd
766 * This function fills SAP and Pst information to send the staInd to
770 * @param[in] Inst inst
771 * @param[in] RgUpSapCb *rguSap
772 * @param[in] RgRguDedStaInd *staInd
778 PUBLIC S16 rgUIMSndDedStaInd
782 RgRguDedStaInd *staInd
785 PUBLIC S16 rgUIMSndDedStaInd(inst,rguSap,staInd)
788 RgRguDedStaInd *staInd;
793 TRC2(rgUIMSndDedStaInd)
795 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
797 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
801 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
805 } /* rgUIMSndDedStaInd */
809 * @brief Handler for sending staInd to a common logical channel.
813 * Function : rgUIMSndCmnStaInd
815 * This function fills SAP and Pst information to send the staInd to
816 * a common logical channel.
819 * @param[in] Inst inst
820 * @param[in] RgUpSapCb *rguSap
821 * @param[in] RgRguCmnStaInd *staInd
827 PUBLIC S16 rgUIMSndCmnStaInd
831 RgRguCmnStaInd *staInd
834 PUBLIC S16 rgUIMSndCmnStaInd(inst,rguDlSap,staInd)
837 RgRguCmnStaInd *staInd;
843 TRC2(rgUIMSndCmnStaInd)
846 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
850 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
854 } /* rgUIMSndCmnStaInd */
858 * @brief Handler for sending datInd to dedicated logical channels of a UE
862 * Function : rgUIMSndDedDatInd
864 * This function fills SAP and Pst information to send the datInd to
868 * @param[in] Inst inst
869 * @param[in] RgUpSapCb *rguUlSap
870 * @param[in] RgRguDedDatInd *datInd
876 PUBLIC S16 rgUIMSndDedDatInd
880 RgRguDedDatInd *datInd
883 PUBLIC S16 rgUIMSndDedDatInd(datInd)
886 RgRguDedDatInd *datInd;
892 TRC2(rgUIMSndDedDatInd)
895 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
897 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
901 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
905 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
906 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
909 } /* rgUIMSndDedDatInd */
913 * @brief Handler for sending datInd to a common logical channel.
917 * Function : rgUIMSndCmnDatInd
919 * This function fills SAP and Pst information to send the datInd to
920 * a common logical channel.
923 * @param[in] Inst inst
924 * @param[in] RgUpSapCb *rguSap
925 * @param[in] RgRguCmnDatInd *datInd
931 PUBLIC S16 rgUIMSndCmnDatInd
935 RgRguCmnDatInd *datInd
938 PUBLIC S16 rgUIMSndCmnDatInd(datInd)
941 RgRguCmnDatInd *datInd;
946 TRC2(rgUIMSndCmnDatInd)
949 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
951 rguUlSap->sapSts.numPduTxmit++;
953 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
954 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
958 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
959 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
963 } /* rgUIMSndCmnDatInd */
967 * @brief API for bind request from RRC towards MAC.
971 * Function: RgUiCrgBndReq
973 * This API is invoked by RRC towards MAC to bind CRG SAP.
974 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
977 * @param[in] Pst *pst
978 * @param[in] SuId suId
979 * @param[in] SpId spId
985 PUBLIC S16 RgUiCrgBndReq
992 PUBLIC S16 RgUiCrgBndReq(pst, suId, spId)
999 Pst tmpPst; /* Temporary Post Structure */
1000 RgUstaDgn dgn; /* Alarm diagnostics structure */
1006 RG_IS_INST_VALID(pst->dstInst);
1007 inst = pst->dstInst - RG_INST_START;
1009 tmpPst.prior = pst->prior;
1010 tmpPst.route = pst->route;
1011 tmpPst.selector = pst->selector;
1012 tmpPst.region = rgCb[inst].rgInit.region;
1013 tmpPst.pool = rgCb[inst].rgInit.pool;
1014 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
1015 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
1016 tmpPst.srcInst = rgCb[inst].rgInit.inst;
1017 tmpPst.event = EVTNONE;
1018 tmpPst.dstProcId = pst->srcProcId;
1019 tmpPst.dstEnt = pst->srcEnt;
1020 tmpPst.dstInst = pst->srcInst;
1023 if(spId == rgCb[inst].crgSap.sapCfg.spId)
1025 /* Check the state of the SAP */
1026 switch (rgCb[inst].crgSap.sapSta.sapState)
1028 case LRG_NOT_CFG: /* SAP Not configured */
1030 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1031 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
1032 LCM_CAUSE_INV_SAP, &dgn);
1033 RLOG0(L_DEBUG,"SAP Not Configured");
1034 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
1036 case LRG_UNBND: /* SAP is not bound */
1037 RLOG0(L_DEBUG,"SAP Not yet bound");
1039 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
1040 rgCb[inst].crgSap.sapCfg.suId = suId;
1041 /* Send Bind Confirm with status as SUCCESS */
1042 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1043 /* Indicate to Layer manager */
1044 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
1045 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
1046 LCM_CAUSE_UNKNOWN, &dgn);
1048 case LRG_BND: /* SAP is already bound*/
1049 RLOG0(L_DEBUG,"SAP is already bound");
1051 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
1053 default: /* Should Never Enter here */
1054 #if (ERRCLASS & ERRCLS_ADD_RES)
1055 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
1056 rgCb[inst].crgSap.sapSta.sapState);
1058 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1064 #if (ERRCLASS & ERRCLS_ADD_RES)
1065 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
1066 rgCb[inst].crgSap.sapCfg.spId);
1068 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
1071 } /* RgUiCrgBndReq */
1075 * @brief API for unbind request from RRC towards MAC.
1079 * Function: RgUiCrgUbndReq
1081 * This API is invoked by RRC towards MAC to unbind CRG SAP.
1082 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
1085 * @param[in] Pst *pst
1086 * @param[in] SuId suId
1087 * @param[in] Reason reason
1093 PUBLIC S16 RgUiCrgUbndReq
1100 PUBLIC S16 RgUiCrgUbndReq(pst, spId, reason)
1107 TRC3(RgUiCrgUbndReq)
1110 RG_IS_INST_VALID(pst->dstInst);
1111 inst = pst->dstInst - RG_INST_START;
1112 /* SAP Id validation */
1113 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1115 switch(rgCb[inst].crgSap.sapSta.sapState)
1117 case LRG_BND: /* SAP is already bound*/
1118 /* setting SAP state to UN BOUND */
1119 RLOG0(L_DEBUG, "SAP is already bound");
1121 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
1124 #if (ERRCLASS & ERRCLS_ADD_RES)
1125 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
1126 rgCb[inst].crgSap.sapSta.sapState);
1133 #if (ERRCLASS & ERRCLS_ADD_RES)
1134 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
1135 rgCb[inst].crgSap.sapCfg.spId);
1140 } /* RgUiCrgUbndReq */
1143 * @brief API for sending bind confirm from MAC to RRC
1147 * Function: rgUIMRgrBndCfm
1149 * This API is invoked to send bind confirm from MAC to RRC.
1150 * This API fills in Pst structure and SAP Ids and invokes
1151 * bind confirm API towards RRC.
1153 * @param[in] Inst inst
1154 * @param[in] SuId suId
1155 * @param[in] U8 status
1161 PUBLIC S16 rgUIMCrgBndCfm
1168 PUBLIC S16 rgUIMCrgBndCfm(inst,suId, status)
1174 TRC2(rgUIMCrgBndCfm)
1177 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
1179 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
1184 } /* rgUIMCrgBndCfm*/
1187 * @brief API for configuration request from RRC towards MAC.
1191 * Function: RgUiCrgCfgReq
1193 * This API is invoked by RRC towards MAC to configure MAC.
1194 * These API validates the Pst, spId, suId and transfers the config request
1195 * specific information to corresponding ownership module (COM) API.
1198 * @param[in] Pst *pst
1199 * @param[in] SpId spId
1200 * @param[in] CrgCfgTransId transId
1201 * @param[in] CrgCfgReqInfo *cfgReqInfo
1207 PUBLIC S16 RgUiCrgCfgReq
1211 CrgCfgTransId transId,
1212 CrgCfgReqInfo *cfgReqInfo
1215 PUBLIC S16 RgUiCrgCfgReq(pst, spId, transId, cfgReqInfo)
1218 CrgCfgTransId transId;
1219 CrgCfgReqInfo *cfgReqInfo;
1224 U8 cfmStatus = 0x00ff;
1225 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1227 TRC3(RgUiCrgCfgReq);
1229 RG_IS_INST_VALID(pst->dstInst);
1230 inst = pst->dstInst - RG_INST_START;
1231 /* Ensuring transId is always Null terminated. */
1232 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1233 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1236 /* CrgCfgReqInfo Validation for NULLP */
1237 if (cfgReqInfo == NULLP)
1239 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1240 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1244 /* Upper SAP Id and State validation */
1245 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1247 switch(rgCb[inst].crgSap.sapSta.sapState)
1249 case LRG_BND: /* SAP is already bound */
1250 RLOG0(L_DEBUG,"SAP is already bound");
1252 default: /* Should never reach here */
1253 #if (ERRCLASS & ERRCLS_ADD_RES)
1254 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1255 rgCb[inst].crgSap.sapSta.sapState);
1257 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1258 sizeof(CrgCfgReqInfo));
1261 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1267 #if (ERRCLASS & ERRCLS_ADD_RES)
1268 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1269 rgCb[inst].crgSap.sapCfg.spId);
1271 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1272 sizeof(CrgCfgReqInfo));
1274 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1277 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1278 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1279 sizeof(CrgCfgReqInfo));
1283 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1288 } /* RgUiCrgCfgReq */
1291 * @brief API for sending configuration confirm from MAC to RRC
1295 * Function: rgUIMCrgCfgCfm
1297 * This API is invoked to send configuration confirm from MAC to RRC.
1298 * This API fills in Pst structure and SAP Ids and invokes
1299 * config confirm API towards RRC.
1301 * @param[in] Inst inst
1302 * @param[in] CrgCfgTransId transId
1303 * @param[in] U8 status
1309 PUBLIC S16 rgUIMCrgCfgCfm
1312 CrgCfgTransId transId,
1316 PUBLIC S16 rgUIMCrgCfgCfm(inst,transId, status)
1318 CrgCfgTransId transId;
1323 U8 prntTrans[CRG_CFG_TRANSID_SIZE+1];
1325 TRC2(rgUIMCrgCfgCfm)
1327 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, CRG_CFG_TRANSID_SIZE);
1328 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1331 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1334 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1339 } /* rgUIMCrgCfgCfm */
1340 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1343 PUBLIC S16 rgBatchProc
1348 PUBLIC S16 rgBatchProc()
1352 /* Read from Ring Buffer and process RLC BO Update */
1355 RguDStaRspInfo *staRsp;
1366 pst.route = RTESPEC;
1367 pst.event = EVTRGUDSTARSP;
1370 pst.selector = 2; /*SM_SELECTOR_LC */
1374 elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1375 while(NULLP != elmIndx)
1377 staRsp = (RguDStaRspInfo *)elmIndx;
1381 RgUiRguDStaRsp(&pst, spId, staRsp);
1385 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1387 if((elmIndx = (U32)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1394 /**********************************************************************
1397 **********************************************************************/