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 Layer Manager Interface Module
29 **********************************************************************/
32 @brief This file contains the Layer Management interface module implementation.
33 The functions for the configuration, control, status and statistics
34 request primitives are defined here.
36 static const char* RLOG_MODULE_NAME="MAC";
37 static int RLOG_FILE_ID=220;
38 static int RLOG_MODULE_ID=4096;
40 /* header include files (.h) */
41 #include "common_def.h"
42 #include "rg_env.h" /* MAC Environment Defines */
43 #include "crg.h" /* CRG Interface defines */
44 #include "rgu.h" /* RGU Interface defines */
45 #include "tfu.h" /* RGU Interface defines */
46 #include "rg_sch_inf.h" /* RGR Interface defines */
47 #include "lrg.h" /* LRG Interface defines */
48 #include "rgr.h" /* LRG Interface defines */
49 #include "rg.h" /* MAC defines */
50 #include "rg_err.h" /* MAC error defines */
53 /* header/extern include files (.x) */
54 #include "crg.x" /* CRG Interface includes */
55 #include "rgu.x" /* RGU Interface includes */
56 #include "tfu.x" /* RGU Interface includes */
57 #include "rg_sch_inf.x" /* SCH Interface includes */
58 #include "rg_prg.x" /* PRG Interface includes */
59 #include "lrg.x" /* LRG Interface includes */
60 #include "rgr.x" /* LRG Interface includes */
61 #include "du_app_mac_inf.h"
62 #include "rg.x" /* MAC includes */
64 #include "ss_diag.h" /* Common log file */
68 #include "lwr_mac.h" /* MAC CL defines */
70 #include "lwr_mac_phy.h"
71 #include "lwr_mac_fsm.h"
75 #endif /* __cplusplus */
76 EXTERN Void rgGetSId ARGS((SystemId *s));
79 #endif /* __cplusplus */
81 /* Public variable declaration */
85 int MacSchCellCfgReq(Pst *pst,MacCellCfg *macCellCfg);
87 /* forward references */
88 PRIVATE U16 rgLMMGenCfg ARGS((
93 PRIVATE U16 rgLMMSapCfg ARGS((
99 PRIVATE Void rgLMMShutdown ARGS((
103 PRIVATE Void rgLMMFillCfmPst ARGS((
109 PRIVATE Void rgLMMGenCntrl ARGS((
115 PRIVATE Void rgLMMSapCntrl ARGS((
121 extern int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
123 packMacCellCfgConfirm packMacCellCfmOpts[] =
125 packMacCellCfgCfm, /* packing for loosely coupled */
126 duHandleMacCellCfgCfm, /* packing for tightly coupled */
127 packMacCellCfgCfm, /* packing for light weight loosly coupled */
130 SchCellCfgFunc SchCellCfgOpts[] =
132 packSchCellCfg, /* packing for loosely coupled */
133 SchHdlCellCfgReq, /* packing for tightly coupled */
134 packSchCellCfg /* packing for light weight loosly coupled */
139 * @brief Task Initiation callback function.
143 * Function : rgActvInit
145 * This function is supplied as one of parameters during MAC's
146 * task registration. SSI will invoke this function once, after
147 * it creates and attaches this TAPA Task to a system task.
149 * @param[in] Ent entity, the entity ID of this task.
150 * @param[in] Inst inst, the instance ID of this task.
151 * @param[in] Region region, the region ID registered for memory
152 * usage of this task.
153 * @param[in] Reason reason.
158 PUBLIC S16 rgActvInit
160 Ent entity, /* entity */
161 Inst inst, /* instance */
162 Region region, /* region */
163 Reason reason /* reason */
166 PUBLIC S16 rgActvInit(entity, inst, region, reason)
167 Ent entity; /* entity */
168 Inst inst; /* instance */
169 Region region; /* region */
170 Reason reason; /* reason */
176 RG_IS_INST_VALID(inst);
178 macInst = inst - RG_INST_START;
179 /* Initialize the MAC TskInit structure to zero */
180 cmMemset ((U8 *)&rgCb[macInst], 0, sizeof(RgCb));
182 /* Initialize the MAC TskInit with received values */
183 rgCb[macInst].rgInit.ent = entity;
184 rgCb[macInst].rgInit.inst = inst;
185 rgCb[macInst].rgInit.region = region;
186 rgCb[macInst].rgInit.pool = 0;
187 rgCb[macInst].rgInit.reason = reason;
188 rgCb[macInst].rgInit.cfgDone = FALSE;
189 rgCb[macInst].rgInit.acnt = FALSE;
190 rgCb[macInst].rgInit.usta = FALSE;
191 rgCb[macInst].rgInit.trc = FALSE;
192 rgCb[macInst].trcLen = 0;
195 /* disabling debugs by default */
196 rgCb[macInst].rgInit.dbgMask = 0xffffffff;
200 rgCb[macInst].rgInit.logMask = 0x0;
202 rgCb[macInst].rgInit.procId = SFndProcId();
203 rgCb[macInst].tfuSap.numBndRetries = 0;
205 /* Initialize Sap state */
206 rgCb[macInst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
207 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
208 rgCb[macInst].rguSap = NULLP;
209 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
211 rgCb[macInst].inactiveCell = NULLP;
212 rgCb[macInst].cell = NULLP;
214 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULMAC,SS_RNG_TX);
215 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULRLC,SS_RNG_RX);
218 /* Initializing CL control block */
219 clGlobalCp.region = region;
221 clGlobalCp.clCfgDone = FALSE;
222 clGlobalCp.numOfCells = 0;
223 clGlobalCp.phyState = PHY_STATE_IDLE;
225 if( cmHashListInit(&clGlobalCp.cellCbLst, MAX_NUM_CELL_SUPP, 0x0, FALSE,
226 CM_HASH_KEYTYPE_DEF, clGlobalCp.region, clGlobalCp.pool ) != ROK )
228 printf("\n Cellcb hash list initialization failed for MAC CL");
232 /* Initialize Scheduler as well */
233 schActvInit(ENTRG, (DEFAULT_CELLS + SCH_INST_START), DFLT_REGION, PWR_UP);
235 /* Initialize lower mac */
243 * @brief Layer Manager Configuration request handler.
247 * Function : RgMiLrgCfgReq
249 * This function handles the configuration
250 * request received from the Layer Manager.
251 * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the
252 * functions rgHdlGenCfg() or rgHdlSapCfg().
253 * -# Invokes RgMiLrgCfgCfm() to send back the confirmation to the LM.
255 * @param[in] Pst *pst, the post structure
256 * @param[in] RgMngmt *cfg, the configuration parameter's structure
261 PUBLIC S16 RgMiLrgCfgReq
263 Pst *pst, /* post structure */
264 RgMngmt *cfg /* config structure */
267 PUBLIC S16 RgMiLrgCfgReq(pst, cfg)
268 Pst *pst; /* post structure */
269 RgMngmt *cfg; /* config structure */
272 U16 ret = LCM_PRIM_OK;
273 U16 reason = LCM_REASON_NOT_APPL;
281 RG_DIAG_LVL0(inst,0x0a0b0001, RG_DIAG_NA, SS_DIAG_INV_ARG,
282 "Received CfgReq for MAC layer, Entity = %d, Instance = %d\n",
283 pst->srcEnt, pst->srcInst,0,0);
285 RG_IS_INST_VALID(pst->dstInst);
286 inst = pst->dstInst - RG_INST_START;
288 /* Fill the post structure for sending the confirmation */
289 rgLMMFillCfmPst(pst, &cfmPst, cfg);
291 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
294 cfm.hdr.transId = cfg->hdr.transId;
298 cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt;
299 switch(cfg->hdr.elmId.elmnt)
302 reason = rgLMMGenCfg(inst,&cfg->t.cfg);
307 reason = rgLMMSapCfg(inst,&cfg->t.cfg, cfg->hdr.elmId.elmnt);
311 reason = LCM_REASON_INVALID_ELMNT;
312 RLOG1(L_ERROR, "Invalid Elmnt=%d",
313 cfg->hdr.elmId.elmnt);
317 if (reason != LCM_REASON_NOT_APPL)
322 cfm.cfm.status = ret;
323 cfm.cfm.reason = reason;
325 RgMiLrgCfgCfm(&cfmPst, &cfm);
328 }/*-- RgMiLrgCfgReq --*/
332 * @brief Layer Manager Statistics request handler.
336 * Function : RgMiLrgStsReq
338 * This function handles the statistics
339 * request received from the Layer Manager.
340 * -# Based on sts->hdr.elmId.elmnt, it retrieves either general or SAP
341 * statistics from the rgCb global control block.
342 * -# If action=ARST, it will reset the statistics parameters in rgCb to 0.
343 * -# Invokes the RgMiLrgStsCfm to send back the confirmation to LM.
345 * @param[in] Pst *pst, the post structure
346 * @param[in] RgMngmt *sts, the statistics parameter's structure
351 PUBLIC S16 RgMiLrgStsReq
353 Pst *pst, /* post structure */
354 RgMngmt *sts /* statistics structure */
357 PUBLIC S16 RgMiLrgStsReq(pst, sts)
358 Pst *pst; /* post structure */
359 RgMngmt *sts; /* statistics structure */
369 RG_IS_INST_VALID(pst->dstInst);
370 inst = pst->dstInst - RG_INST_START;
371 /* Fill the post structure for sending the confirmation */
372 rgLMMFillCfmPst(pst, &cfmPst, sts);
374 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
377 cfm.hdr.transId = sts->hdr.transId;
379 SGetDateTime(&cfm.t.sts.dt);
380 cfm.cfm.status = LCM_PRIM_OK;
381 cfm.cfm.reason = LCM_REASON_NOT_APPL;
382 cfm.hdr.elmId.elmnt = sts->hdr.elmId.elmnt;
383 cfm.t.sts.action = sts->t.sts.action;
385 /* Check if General Config Done */
386 if(rgCb[inst].rgInit.cfgDone != TRUE)
388 cfm.cfm.status = LCM_PRIM_NOK;
389 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
390 RgMiLrgStsCfm(&cfmPst,&cfm);
391 RLOG0(L_ERROR, "Gen Cfg not done");
395 switch(sts->hdr.elmId.elmnt)
399 cmMemcpy((U8 *)&(cfm.t.sts.s.genSts), (U8 *)&rgCb[inst].genSts,
401 /* check if action is read and reset */
402 if(sts->t.sts.action == ARST)
404 rgCb[inst].genSts.numHarqFail = 0;
409 RgGenSts *genSts = &(cfm.t.sts.s.genSts);
411 for(cqi=0; cqi <= 14; cqi++)
413 /* Filling DL ACK/NACK stats */
414 genSts->nackAckStats.dlCqiStat[cqi].mcs = \
415 hqFailStats.dlCqiStat[cqi].mcs;
416 genSts->nackAckStats.dlCqiStat[cqi].numOfNacks = \
417 hqFailStats.dlCqiStat[cqi].numOfNacks;
418 genSts->nackAckStats.dlCqiStat[cqi].numOfAcks =
419 hqFailStats.dlCqiStat[cqi].numOfAcks;
421 /* Filling UL ACK/NACK stats */
422 genSts->nackAckStats.ulCqiStat[cqi].mcs = \
423 hqFailStats.ulCqiStat[cqi].mcs;
424 genSts->nackAckStats.ulCqiStat[cqi].numOfNacks = \
425 hqFailStats.ulCqiStat[cqi].numOfNacks;
426 genSts->nackAckStats.ulCqiStat[cqi].numOfAcks = \
427 hqFailStats.ulCqiStat[cqi].numOfAcks;
429 /* Filling DL HQ Retx stats */
430 genSts->hqRetxStats.dlCqiStat[cqi].mcs = \
431 hqRetxStats.dlCqiStat[cqi].mcs;
432 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_1 = \
433 hqRetxStats.dlCqiStat[cqi].numOfHQ_1;
434 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_2 = \
435 hqRetxStats.dlCqiStat[cqi].numOfHQ_2;
436 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_3 = \
437 hqRetxStats.dlCqiStat[cqi].numOfHQ_3;
438 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_4 = \
439 hqRetxStats.dlCqiStat[cqi].numOfHQ_4;
440 genSts->hqRetxStats.dlCqiStat[cqi].totalTx = \
441 hqRetxStats.dlCqiStat[cqi].totalTx;
443 /* Filling UL HQ Retx stats */
444 genSts->hqRetxStats.ulCqiStat[cqi].mcs = \
445 hqRetxStats.ulCqiStat[cqi].mcs;
446 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_1 = \
447 hqRetxStats.ulCqiStat[cqi].numOfHQ_1;
448 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_2 = \
449 hqRetxStats.ulCqiStat[cqi].numOfHQ_2;
450 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_3 = \
451 hqRetxStats.ulCqiStat[cqi].numOfHQ_3;
452 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_4 = \
453 hqRetxStats.ulCqiStat[cqi].numOfHQ_4;
454 genSts->hqRetxStats.ulCqiStat[cqi].totalTx = \
455 hqRetxStats.ulCqiStat[cqi].totalTx;
457 /* Reset statistics */
458 if(sts->t.sts.action == ZEROSTS)
460 cmMemset((U8 *)&hqRetxStats, 0, \
461 sizeof(RgSchHqRetxStats));
462 cmMemset((U8 *)&hqFailStats, 0, \
463 sizeof(RgSchNackAckStats));
466 #endif /* MAC_SCH_STATS*/
470 cmMemcpy((U8 *)&(cfm.t.sts.s.rguSts), (U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts,
473 /* check if action is read and reset */
474 if(sts->t.sts.action == ARST)
475 cmMemset((U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts, 0, sizeof(RgSapSts));
479 cmMemcpy((U8 *)&(cfm.t.sts.s.crgSts), (U8 *)&rgCb[inst].crgSap.sapSts,
482 /* check if action is read and reset */
483 if(sts->t.sts.action == ARST)
484 cmMemset((U8 *)&rgCb[inst].crgSap.sapSts, 0, sizeof(RgSapSts));
488 cmMemcpy((U8 *)&(cfm.t.sts.s.tfuSts), (U8 *)&rgCb[inst].tfuSap.sapSts,
491 /* check if action is read and reset */
492 if(sts->t.sts.action == ARST)
493 cmMemset((U8 *)&rgCb[inst].tfuSap.sapSts, 0, sizeof(RgSapSts));
497 cfm.cfm.status = LCM_PRIM_NOK;
498 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
499 RLOG1(L_ERROR, "Invalid Elmnt = %d",sts->hdr.elmId.elmnt);
502 RgMiLrgStsCfm(&cfmPst,&cfm);
504 }/*-- RgMiLrgStsReq --*/
508 * @brief Layer Manager Status request handler.
512 * Function : RgMiLrgStaReq
514 * This function handles the solicited status
515 * request received from the Layer Manager.
516 * -# Based on sta->hdr.elmId.elmnt, it retrieves the status of a
517 * particular SAP from the rgCb global control block.
518 * -# Invokes the RgMiLrgStaCfm to send back the confirmation to LM.
520 * @param[in] Pst *pst, the post structure
521 * @param[in] RgMngmt *sta, the status parameter's structure
526 PUBLIC S16 RgMiLrgStaReq
528 Pst *pst, /* post structure */
529 RgMngmt *sta /* status structure */
532 PUBLIC S16 RgMiLrgStaReq(pst, sta)
533 Pst *pst; /* post structure */
534 RgMngmt *sta; /* status structure */
544 RG_IS_INST_VALID(pst->dstInst);
545 inst = pst->dstInst - RG_INST_START;
548 /* Fill the post structure for sending the confirmation */
549 rgLMMFillCfmPst(pst, &cfmPst, sta);
551 if (sta->t.ssta.s.sysId.ptNmb != NULLP)
553 SPutSBuf(pst->region, pst->pool, (Data *)sta->t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
556 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
557 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
560 cfm.hdr.transId = sta->hdr.transId;
562 /* Check if General Config Done */
563 if(rgCb[inst].rgInit.cfgDone != TRUE)
565 SGetDateTime(&cfm.t.ssta.dt);
566 if (SGetSBuf(cfmPst.region, cfmPst.pool,
567 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
570 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
573 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
574 rgGetSId(&cfm.t.ssta.s.sysId);
575 cfm.cfm.status = LCM_PRIM_NOK;
576 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
577 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
578 RgMiLrgStaCfm(&cfmPst, &cfm);
579 RLOG0(L_ERROR, "Gen Cfg not done");
583 switch(sta->hdr.elmId.elmnt)
586 SGetDateTime(&cfm.t.ssta.dt);
587 if (SGetSBuf(cfmPst.region, cfmPst.pool,
588 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
591 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
594 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
595 rgGetSId(&cfm.t.ssta.s.sysId);
596 cfm.cfm.status = LCM_PRIM_OK;
597 cfm.cfm.reason = LCM_REASON_NOT_APPL;
598 RgMiLrgStaCfm(&cfmPst, &cfm);
601 cfm.cfm.status = LCM_PRIM_OK;
602 cfm.cfm.reason = LCM_REASON_NOT_APPL;
603 SGetDateTime(&cfm.t.ssta.dt);
604 cmMemcpy((U8 *)&(cfm.t.ssta.s.rguSapSta),
605 (U8 *)&rgCb[inst].rguSap[sta->t.ssta.sapInst].sapSta,
607 RgMiLrgStaCfm(&cfmPst, &cfm);
610 cfm.cfm.status = LCM_PRIM_OK;
611 cfm.cfm.reason = LCM_REASON_NOT_APPL;
612 SGetDateTime(&cfm.t.ssta.dt);
613 cmMemcpy((U8 *)&(cfm.t.ssta.s.crgSapSta), (U8 *)&rgCb[inst].crgSap.sapSta,
615 RgMiLrgStaCfm(&cfmPst, &cfm);
618 cfm.cfm.status = LCM_PRIM_OK;
619 cfm.cfm.reason = LCM_REASON_NOT_APPL;
620 SGetDateTime(&cfm.t.ssta.dt);
621 cmMemcpy((U8 *)&(cfm.t.ssta.s.tfuSapSta), (U8 *)&rgCb[inst].tfuSap.sapSta,
623 RgMiLrgStaCfm(&cfmPst, &cfm);
626 cfm.cfm.status = LCM_PRIM_NOK;
627 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
628 RgMiLrgStaCfm(&cfmPst, &cfm);
629 RLOG1(L_ERROR, "Invalid elmnt=%d",sta->hdr.elmId.elmnt);
633 }/*-- RgMiLrgStaReq --*/
637 * @brief Layer Manager Control request handler.
641 * Function : RgMiLrgCntrlReq
643 * This function handles the control
644 * request received from the Layer Manager.
645 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
646 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
647 * of SAP (enable/disable), Debug (enable/disable), Trace (enable/disable)
648 * and layer shutdown.
649 * -# Invokes the RgMiLrgCntrlCfm to send back the confirmation to LM.
651 * @param[in] Pst *pst, the post structure
652 * @param[in] RgMngmt *cntrl, the control parameter's structure
657 PUBLIC S16 RgMiLrgCntrlReq
659 Pst *pst, /* post structure */
660 RgMngmt *cntrl /* control structure */
663 PUBLIC S16 RgMiLrgCntrlReq(pst, cntrl)
664 Pst *pst; /* post structure */
665 RgMngmt *cntrl; /* control structure */
668 S16 ret = ROK; /* return value */
673 TRC2(RgMiLrgCntrlReq)
675 /* Fill the post structure for sending the confirmation */
677 RG_IS_INST_VALID(pst->dstInst);
678 inst = pst->dstInst - RG_INST_START;
680 rgLMMFillCfmPst(pst, &cfmPst, cntrl);
682 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
684 cfm.hdr.transId = cntrl->hdr.transId;
686 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
687 cfm.t.cntrl.action = cntrl->t.cntrl.action;
688 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
690 /* Check if General Config Done*/
691 if(rgCb[inst].rgInit.cfgDone != TRUE)
693 cfm.cfm.status = LCM_PRIM_NOK;
694 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
695 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
696 RgMiLrgCntrlCfm(&cfmPst, &cfm);
697 RLOG0(L_ERROR, "Gen Cfg not done");
701 /* General Config done, process the Control request */
702 switch(cntrl->hdr.elmId.elmnt)
705 rgLMMGenCntrl(cntrl, &cfm, &cfmPst);
710 rgLMMSapCntrl(cntrl, &cfm, &cfmPst);
713 cfm.cfm.status = LCM_PRIM_NOK;
714 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
715 RgMiLrgCntrlCfm(&cfmPst, &cfm);
716 RLOG1(L_ERROR, "invalid elmnt=%d",cntrl->hdr.elmId.elmnt);
720 }/*-- RgMiLrgCntrlReq --*/
724 * @brief SAP Configuration Handler.
728 * Function : rgLMMSapCfg
730 * This function in called by RgMiLrgCfgReq(). It handles the
731 * interface SAP configuration of the LTE MAC layer. It
732 * initializes the sapState to LRG_UNBND. Returns
733 * reason for success/failure of this function.
735 * @param[in] Inst inst
736 * @param[in] RgCfg *cfg, the Configuaration information
738 * -# LCM_REASON_GENCFG_NOT_DONE
739 * -# LCM_REASON_INVALID_SAP
740 * -# LCM_REASON_NOT_APPL
743 PRIVATE U16 rgLMMSapCfg
746 RgCfg *cfg, /* Configuaration information */
747 Elmnt sapType /* Sap Type */
750 PRIVATE U16 rgLMMSapCfg(inst,cfg,sapType)
752 RgCfg *cfg; /* Configuaration information */
753 Elmnt sapType; /* Sap Type */
756 U16 ret = LCM_REASON_NOT_APPL;
757 RgLowSapCfgInfo *lowSapCfg = NULLP;
758 RgUpSapCfgInfo *upSapCfg = NULLP;
759 RgUpSapCb *upSapCb = NULLP;
763 /* Check if Gen Config has been done */
764 if(rgCb[inst].rgInit.cfgDone != TRUE)
765 RETVALUE(LCM_REASON_GENCFG_NOT_DONE);
770 if ((cfg->s.rguSap.spId > LRG_MAX_RGU_SAPS) &&
771 (cfg->s.rguSap.selector != ODU_SELECTOR_TC) &&
772 (cfg->s.rguSap.selector != ODU_SELECTOR_LC))
774 ret = LCM_REASON_INVALID_PAR_VAL;
775 RLOG0(L_ERROR, "unsupported Selector value for RGU");
778 upSapCb = &(rgCb[inst].rguSap[cfg->s.rguSap.spId]);
779 if(upSapCb->sapSta.sapState == LRG_NOT_CFG)
781 upSapCb->sapSta.sapState = LRG_UNBND;
783 upSapCfg = &(upSapCb->sapCfg);
784 upSapCfg->sapPst.dstEnt = cfg->s.rguSap.ent;
785 upSapCfg->sapPst.dstInst = cfg->s.rguSap.inst;
786 upSapCfg->sapPst.dstProcId = cfg->s.rguSap.procId;
787 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
788 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
789 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
790 upSapCfg->sapPst.region = cfg->s.rguSap.mem.region;
791 upSapCfg->sapPst.pool = cfg->s.rguSap.mem.pool;
792 upSapCfg->sapPst.selector = cfg->s.rguSap.selector;
793 upSapCfg->sapPst.route = cfg->s.rguSap.route;
794 upSapCfg->sapPst.intfVer = 0;
795 upSapCfg->sapPst.prior = cfg->s.rguSap.prior;
796 upSapCfg->suId = cfg->s.rguSap.suId;
797 upSapCfg->spId = cfg->s.rguSap.spId;
798 /*T2K uses 2 saps, T3K uses 1 sap. change the rgRguDlSap to 1 only if
799 * there is cfg request with sap is 1*/
802 if ((cfg->s.crgSap.selector != ODU_SELECTOR_TC) &&
803 (cfg->s.crgSap.selector != ODU_SELECTOR_LC))
805 ret = LCM_REASON_INVALID_PAR_VAL;
806 RLOG0(L_ERROR, "unsupported Selector value for CRG");
809 if(rgCb[inst].crgSap.sapSta.sapState == LRG_NOT_CFG)
811 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
813 upSapCfg = &rgCb[inst].crgSap.sapCfg;
815 upSapCfg->sapPst.dstEnt = cfg->s.crgSap.ent;
816 upSapCfg->sapPst.dstInst = cfg->s.crgSap.inst;
817 upSapCfg->sapPst.dstProcId = cfg->s.crgSap.procId;
818 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
819 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
820 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
821 upSapCfg->sapPst.region = cfg->s.crgSap.mem.region;
822 upSapCfg->sapPst.pool = cfg->s.crgSap.mem.pool;
823 upSapCfg->sapPst.selector = cfg->s.crgSap.selector;
824 upSapCfg->sapPst.route = cfg->s.crgSap.route;
825 upSapCfg->sapPst.intfVer = 0;
826 upSapCfg->sapPst.prior = cfg->s.crgSap.prior;
827 upSapCfg->suId = cfg->s.crgSap.suId;
828 upSapCfg->spId = cfg->s.crgSap.spId;
832 if ((cfg->s.tfuSap.selector != ODU_SELECTOR_TC) &&
833 (cfg->s.tfuSap.selector != ODU_SELECTOR_LC))
835 ret = LCM_REASON_INVALID_PAR_VAL;
836 RLOG0(L_ERROR, "unsupported Selector value for TFU");
840 if (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG)
842 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
844 lowSapCfg = &rgCb[inst].tfuSap.sapCfg;
846 lowSapCfg->sapPst.dstEnt = cfg->s.tfuSap.ent;
847 lowSapCfg->sapPst.dstInst = cfg->s.tfuSap.inst;
848 lowSapCfg->sapPst.dstProcId = rgCb[inst].rgInit.procId;
849 lowSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
850 lowSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
851 lowSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
852 lowSapCfg->sapPst.region = cfg->s.tfuSap.mem.region;
853 lowSapCfg->sapPst.pool = cfg->s.tfuSap.mem.pool;
854 lowSapCfg->sapPst.selector = cfg->s.tfuSap.selector;
855 lowSapCfg->sapPst.route = cfg->s.tfuSap.route;
856 lowSapCfg->sapPst.intfVer = 0;
857 lowSapCfg->sapPst.prior = cfg->s.tfuSap.prior;
858 lowSapCfg->suId = cfg->s.tfuSap.suId;
859 lowSapCfg->spId = cfg->s.tfuSap.spId;
860 cmMemcpy((U8 *)&lowSapCfg->bndTmr, (U8 *)&cfg->s.tfuSap.bndTmr,
864 /* would never reach here */
872 * @brief General Configuration Handler.
876 * Function : rgLMMGenCfg
878 * This function in called by RgMiLrgCfgReq(). It handles the
879 * general configuration of the LTE MAC layer. It initializes
880 * the hash lists of RgCb. Returns
881 * reason for success/failure of this function.
883 * @param[in] Inst inst
884 * @param[in] RgCfg *cfg, the Configuaration information
886 * -# LCM_REASON_NOT_APPL
887 * -# LCM_REASON_INVALID_MSGTYPE
888 * -# LCM_REASON_MEM_NOAVAIL
891 PRIVATE U16 rgLMMGenCfg
894 RgCfg *cfg /* Configuaration information */
897 PRIVATE U16 rgLMMGenCfg(inst,cfg)
899 RgCfg *cfg; /* Configuaration information */
902 U16 ret = LCM_REASON_NOT_APPL;
906 /* Check if General Configuration is done already */
907 if (rgCb[inst].rgInit.cfgDone == TRUE)
909 RETVALUE(LCM_REASON_INVALID_MSGTYPE);
911 if ((cfg->s.genCfg.lmPst.selector != ODU_SELECTOR_TC) &&
912 (cfg->s.genCfg.lmPst.selector != ODU_SELECTOR_LC))
914 RLOG0(L_ERROR, "unsupported Selector value for RGU");
915 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
917 /* Update the Pst structure for LM interface */
918 cmMemcpy((U8 *)&rgCb[inst].rgInit.lmPst, (U8 *)&cfg->s.genCfg.lmPst,
921 rgCb[inst].rgInit.lmPst.srcProcId = rgCb[inst].rgInit.procId;
922 rgCb[inst].rgInit.lmPst.srcEnt = rgCb[inst].rgInit.ent;
923 rgCb[inst].rgInit.lmPst.srcInst = rgCb[inst].rgInit.inst;
924 rgCb[inst].rgInit.lmPst.event = EVTNONE;
926 rgCb[inst].rgInit.region = cfg->s.genCfg.mem.region;
927 rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool;
928 rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes;
930 macCb.macInst = rgCb[inst].rgInit.inst;
932 /* Initialize SAP States */
933 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
935 if(cfg->s.genCfg.numRguSaps == 0)
937 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Invalid numRguSap.\n"));
941 /* allocate RGR saps */
942 if (SGetSBuf(rgCb[inst].rgInit.region,
943 rgCb[inst].rgInit.pool,
944 (Data **)&rgCb[inst].rguSap,
945 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps)) != ROK)
947 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Failed to allocate mem for RGU SAP's.\n"));
950 rgCb[inst].numRguSaps = cfg->s.genCfg.numRguSaps;
952 for (int idx = 0; idx < rgCb[inst].numRguSaps; idx++)
954 rgCb[inst].rguSap[idx].sapSta.sapState = LRG_NOT_CFG;
955 cmMemset((U8 *)&rgCb[inst].rguSap[idx], 0, sizeof(RgUpSapCb));
957 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
958 /* Initialize the timer blocks */
959 cmInitTimers(rgCb[inst].tmrBlk, RG_MAX_TIMER);
960 /* Initialzie the timer queue */
961 cmMemset((U8 *)&rgCb[inst].tmrTq, 0, sizeof(CmTqType)*RG_TQ_SIZE);
962 /* Initialize the timer control point */
963 cmMemset((U8 *)&rgCb[inst].tmrTqCp, 0, sizeof(CmTqCp));
964 rgCb[inst].tmrTqCp.tmrLen = RG_TQ_SIZE;
966 /* Timer Registration request to SSI */
967 if (SRegTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
968 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr) != ROK)
971 RLOG0(L_ERROR, "Failed to register timer");
973 SPutSBuf(rgCb[inst].rgInit.region,
974 rgCb[inst].rgInit.pool,
975 (Data *)rgCb[inst].rguSap,
976 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps));
978 RETVALUE(LCM_REASON_MEM_NOAVAIL);
981 /* Set Config done in TskInit */
982 rgCb[inst].rgInit.cfgDone = TRUE;
988 /***********************************************************
990 * Func : rgLMMShutdown
993 * Desc : Handles the MAC layer shutdown request. Calls
994 * rgCFGFreeCellCb(RgCellCb*) to handle each cellCb deallocation.
1003 **********************************************************/
1005 PRIVATE Void rgLMMShutdown
1010 PRIVATE Void rgLMMShutdown(inst)
1014 RgCellCb *cell = rgCb[inst].cell;
1019 /* Unbind the TFU Sap */
1020 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM)
1022 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1023 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1025 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1027 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1029 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_BND)
1031 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1032 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1038 for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
1040 rgTOMRlsSf(inst,&cell->subFrms[idx]);
1043 rgCFGFreeCellCb(cell);
1046 /* Deleting the RGU SAPs */
1047 SPutSBuf(rgCb[inst].rgInit.region,
1048 rgCb[inst].rgInit.pool,
1049 (Data *)rgCb[inst].rguSap,
1050 (sizeof(RgUpSapCb) * rgCb[inst].numRguSaps));
1051 rgCb[inst].rguSap = NULLP;
1053 rgCb[inst].inactiveCell = NULLP;
1054 rgCb[inst].cell = NULLP;
1056 /* De-register the Timer Service */
1057 (Void) SDeregTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
1058 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr);
1060 /* call back the task initialization function to intialize
1061 * the global RgCb Struct */
1062 rgActvInit(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, rgCb[inst].rgInit.region,
1063 rgCb[inst].rgInit.reason);
1069 /***********************************************************
1071 * Func : rgLMMGenCntrl
1074 * Desc : Processes the LM control request for STGEN elmnt.
1083 **********************************************************/
1085 PRIVATE Void rgLMMGenCntrl
1092 PRIVATE Void rgLMMGenCntrl(cntrl, cfm, cfmPst)
1098 Inst inst = (cfmPst->srcInst - RG_INST_START);
1101 cfm->cfm.status = LCM_PRIM_OK;
1102 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1105 switch(cntrl->t.cntrl.action)
1108 /* Action is Enable */
1109 switch(cntrl->t.cntrl.subAction)
1113 rgCb[inst].rgInit.trc = TRUE;
1114 rgCb[inst].trcLen = cntrl->t.cntrl.s.trcLen;
1115 /*Store the response and TransId for sending the Traces */
1116 cmMemcpy((U8 *)&rgCb[inst].genCfg.trcResp.response,
1117 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1118 rgCb[inst].genCfg.trcResp.transId = cntrl->hdr.transId;
1122 /* Enable Unsolicited Status (alarms) */
1123 rgCb[inst].rgInit.usta = TRUE;
1124 /*Store the response and TransId for sending the Alarms */
1125 cmMemcpy((U8 *)&rgCb[inst].genCfg.ustaResp.response,
1126 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1127 rgCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
1130 /* Enable Debug Printing */
1132 rgCb[inst].rgInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1137 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1142 cfm->cfm.status = LCM_PRIM_NOK;
1143 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1144 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1149 /* Action is Diable immidiately */
1150 switch(cntrl->t.cntrl.subAction)
1153 /* Disable Traces */
1154 rgCb[inst].rgInit.trc = FALSE;
1157 /* Disable Unsolicited Status (alarms) */
1158 rgCb[inst].rgInit.usta = FALSE;
1161 /* Disable Debug Printing */
1163 rgCb[inst].rgInit.dbgMask &=~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1168 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1173 cfm->cfm.status = LCM_PRIM_NOK;
1174 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1175 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1180 /* Free all the memory dynamically allocated by MAC */
1181 rgLMMShutdown(inst);
1184 cfm->cfm.status = LCM_PRIM_NOK;
1185 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1186 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1189 RgMiLrgCntrlCfm(cfmPst, cfm);
1194 /***********************************************************
1196 * Func : rgLMMSapCntrl
1199 * Desc : Processes the LM control request for STxxxSAP elmnt.
1208 **********************************************************/
1210 PRIVATE Void rgLMMSapCntrl
1217 PRIVATE Void rgLMMSapCntrl(cntrl, cfm, cfmPst)
1223 Inst inst = cfmPst->srcInst - RG_INST_START;
1226 /* Only TFU Sap can be controlled by LM */
1227 switch(cntrl->hdr.elmId.elmnt)
1230 switch(cntrl->t.cntrl.action)
1233 /* Bind Enable Request */
1234 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1235 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1237 cfm->cfm.status = LCM_PRIM_NOK;
1238 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
1242 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1244 rgLMMStartTmr(inst,RG_BNDREQ_TMR, rgCb[inst].tfuSap.sapCfg.bndTmr.val,
1245 (PTR)&rgCb[inst].tfuSap);
1247 /* Change SAP state */
1248 rgCb[inst].tfuSap.sapSta.sapState = LRG_WAIT_BNDCFM;
1249 rgCb[inst].tfuSap.numBndRetries++;
1250 /* Store the response and TransId for sending
1251 * the Control confirm */
1252 cmMemcpy((U8 *)&rgCb[inst].genCfg.bndCfmResp.response,
1253 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1254 rgCb[inst].genCfg.bndCfmResp.transId = cntrl->hdr.transId;
1256 /* Sending Status Indication to Layer Manager */
1257 cfm->cfm.status = LCM_PRIM_OK_NDONE;
1258 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1259 RgMiLrgCntrlCfm(cfmPst, cfm);
1261 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1262 rgCb[inst].tfuSap.sapCfg.spId);
1267 /* Unbind request */
1269 /* Check if the SAP is configured */
1270 if( (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1271 (rgCb[inst].tfuSap.sapSta.sapState == LRG_UNBND))
1273 cfm->cfm.status = LCM_PRIM_NOK;
1274 cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
1278 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1279 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1281 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1283 /* Change SAP state */
1284 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1285 cfm->cfm.status = LCM_PRIM_OK;
1286 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1290 /* Delete SAP, does initialization of SAP */
1291 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM) ||
1292 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1294 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1295 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1297 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1300 cmMemset((U8 *)&rgCb[inst].tfuSap, 0, sizeof(RgLowSapCb));
1301 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
1302 cfm->cfm.status = LCM_PRIM_OK;
1303 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1306 cfm->cfm.status = LCM_PRIM_NOK;
1307 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1308 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1309 cntrl->t.cntrl.action));
1314 switch(cntrl->t.cntrl.action)
1317 cmMemset((U8 *)&rgCb[inst].rguSap[cntrl->t.cntrl.instId], 0, sizeof(RgUpSapCb));
1318 rgCb[inst].rguSap[cntrl->t.cntrl.instId].sapSta.sapState = LRG_NOT_CFG;
1319 cfm->cfm.status = LCM_PRIM_OK;
1320 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1323 cfm->cfm.status = LCM_PRIM_NOK;
1324 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1325 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1326 cntrl->t.cntrl.action));
1331 switch(cntrl->t.cntrl.action)
1334 cmMemset((U8 *)&rgCb[inst].crgSap, 0, sizeof(RgUpSapCb));
1335 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
1336 cfm->cfm.status = LCM_PRIM_OK;
1337 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1340 cfm->cfm.status = LCM_PRIM_NOK;
1341 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1342 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1348 /* Would never here. */
1351 RgMiLrgCntrlCfm(cfmPst, cfm);
1356 /***********************************************************
1358 * Func : rgLMMFillCfmPst
1361 * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
1362 * and the cfm->hdr.response.
1371 **********************************************************/
1373 PRIVATE Void rgLMMFillCfmPst
1380 PRIVATE Void rgLMMFillCfmPst(reqPst, cfmPst, cfm)
1387 TRC2(rgLMMFillCfmPst)
1388 inst = (reqPst->dstInst - RG_INST_START);
1390 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
1391 cfmPst->srcInst = rgCb[inst].rgInit.inst;
1392 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
1393 cfmPst->dstEnt = reqPst->srcEnt;
1394 cfmPst->dstInst = reqPst->srcInst;
1395 cfmPst->dstProcId = reqPst->srcProcId;
1397 cfmPst->selector = cfm->hdr.response.selector;
1398 cfmPst->prior = cfm->hdr.response.prior;
1399 cfmPst->route = cfm->hdr.response.route;
1400 cfmPst->region = cfm->hdr.response.mem.region;
1401 cfmPst->pool = cfm->hdr.response.mem.pool;
1408 * @brief Timer start handler.
1412 * Function : rgLMMStartTmr
1414 * This function based on the input parameters starts the timer for
1415 * "tmrVal" duration. As of now MAC uses the timer functionality for
1416 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1418 * @param[in] Inst inst
1419 * @param[in] S16 tmrEvnt, the Timer Event
1420 * @param[in] U32 tmrVal, the Wait Time
1421 * @param[in] PTR cb, Entry for which Timer expired
1426 PUBLIC S16 rgLMMStartTmr
1429 S16 tmrEvnt, /* Timer Event */
1430 U32 tmrVal, /* Wait Time */
1431 PTR cb /* Entry for which Timer Expired */
1434 PUBLIC S16 rgLMMStartTmr(tmrEvnt, tmrVal, cb)
1436 S16 tmrEvnt; /* Timer Event */
1437 U32 tmrVal; /* Wait Time */
1438 PTR cb; /* Entry for which Timer Expired */
1447 /* Initialize the arg structure */
1448 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1450 arg.tqCp = &rgCb[inst].tmrTqCp;
1451 arg.tq = rgCb[inst].tmrTq;
1452 arg.timers = rgCb[inst].tmrBlk;
1455 arg.max = RG_MAX_TIMER;
1456 arg.evnt = RG_BNDREQ_TMR;
1465 * @brief Timer stop handler.
1469 * Function : rgLMMStopTmr
1471 * This function based on the input parameters stops the timer for
1472 * "tmrEvnt". As of now MAC uses the timer functionality for
1473 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1474 * Once the bind happens and this timer is stopped, the timer functionality
1475 * is deregistered with SSI. As there is no further use of timer processing.
1477 * @param[in] Inst inst
1478 * @param[in] S16 tmrEvnt, the Timer Event
1479 * @param[in] PTR cb, Entry for which Timer expired
1485 PUBLIC S16 rgLMMStopTmr
1487 Inst inst, /* Scheduler instance */
1488 S16 tmrEvnt, /* Timer Event */
1489 PTR cb /* Entry for which Timer Expired */
1492 PUBLIC S16 rgLMMStopTmr(inst,tmrEvnt, cb)
1493 Inst inst; /* Scheduler instance */
1494 S16 tmrEvnt; /* Timer Event */
1495 PTR cb; /* Entry for which Timer Expired */
1506 for(i=0;i<RG_MAX_TIMER;i++)
1508 /* Search for the Timer Blocks */
1509 if(rgCb[inst].tmrBlk[i].tmrEvnt == tmrEvnt)
1511 /* Initialize the arg structure */
1512 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1514 arg.tqCp = &rgCb[inst].tmrTqCp;
1515 arg.tq = rgCb[inst].tmrTq;
1516 arg.timers = rgCb[inst].tmrBlk;
1518 arg.max = RG_MAX_TIMER;
1536 * @brief Timer Expiry handler.
1540 * Function : rgLMMTmrExpiry
1542 * This is a callback function used as an input parameter to cmPrcTmr()
1543 * to check expiry of any timer. In this function, the only concern is
1544 * about tmrEvnt=Bind timer.
1546 * @param[in] PTR cb, Entry for which Timer expired
1547 * @param[in] S16 tmrEvnt, the Timer Event
1552 PUBLIC S16 rgLMMTmrExpiry
1554 PTR cb, /* Pointer to timer control block */
1555 S16 tmrEvnt /* Timer Event */
1558 PUBLIC S16 rgLMMTmrExpiry(cb,tmrEvnt)
1559 PTR cb; /* Pointer to timer control block */
1560 S16 tmrEvnt; /* Timer Event */
1564 RgLowSapCb *tfuSap = (RgLowSapCb *)cb;
1565 Inst inst = tfuSap->sapCfg.sapPst.srcInst - RG_INST_START;
1567 TRC2(rgLMMTmrExpiry)
1573 tfuSap->numBndRetries++;
1574 if(tfuSap->numBndRetries > RG_MAX_BNDRETRY)
1576 rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_FAIL,
1577 LCM_CAUSE_TMR_EXPIRED, NULLP);
1581 /* Restart the bind timer */
1582 if (tfuSap->sapCfg.bndTmr.enb == TRUE)
1584 ret = rgLMMStartTmr(inst,RG_BNDREQ_TMR, tfuSap->sapCfg.bndTmr.val,
1588 /* Send bind request */
1589 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1590 rgCb[inst].tfuSap.sapCfg.spId);
1594 RLOG1(L_ERROR, "Invalid tmrEvnt=%d",tmrEvnt);
1604 * @brief Layer Manager Unsolicited Status Indication generation.
1608 * Function : rgLMMStaInd
1610 * This API is used by the other modules of MAC to send a unsolicited
1611 * status indication to the Layer Manager.
1613 * @param[in] Inst inst
1614 * @param[in] U16 category, the Alarm category
1615 * @param[in] U16 event, the Alarm event
1616 * @param[in] U16 cause, the cause of the Alarm
1617 * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
1622 PUBLIC S16 rgLMMStaInd
1631 PUBLIC S16 rgLMMStaInd(inst,category, event, cause, dgn)
1643 if(rgCb[inst].rgInit.usta == FALSE)
1648 cmMemset((U8 *)&usta, 0, sizeof(RgMngmt));
1650 SGetDateTime(&usta.t.usta.cmAlarm.dt);
1651 usta.t.usta.cmAlarm.category = category;
1652 usta.t.usta.cmAlarm.event = event;
1653 usta.t.usta.cmAlarm.cause = cause;
1656 cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn));
1659 rgCb[inst].rgInit.lmPst.selector = rgCb[inst].genCfg.ustaResp.response.selector;
1660 rgCb[inst].rgInit.lmPst.prior = rgCb[inst].genCfg.ustaResp.response.prior;
1661 rgCb[inst].rgInit.lmPst.route = rgCb[inst].genCfg.ustaResp.response.route;
1662 rgCb[inst].rgInit.lmPst.region = rgCb[inst].genCfg.ustaResp.response.mem.region;
1663 rgCb[inst].rgInit.lmPst.pool = rgCb[inst].genCfg.ustaResp.response.mem.pool;
1664 usta.hdr.transId = rgCb[inst].genCfg.ustaResp.transId;
1666 RETVALUE(RgMiLrgStaInd(&rgCb[inst].rgInit.lmPst, &usta));
1671 * @brief Layer Manager Trace Indication generation.
1675 * Function : rgLMMTrcInd
1677 * This API is used by the other modules of MAC to send a
1678 * Trace indication to the Layer Manager.
1680 * @param[in] Inst inst
1681 * @param[in] Buffer *srcMbuf, the Message Buffer .
1682 * @param[in] U8 event, the trace event.
1686 PUBLIC Void rgLMMTrcInd
1689 Buffer *srcMbuf, /* Message Buffer */
1690 U8 event /* event */
1693 PUBLIC Void rgLMMTrcInd(inst,srcMbuf,event)
1695 Buffer *srcMbuf; /* Message Buffer */
1696 U8 event; /* event */
1699 Buffer *dstMbuf = NULLP;
1709 if ((rgCb[inst].trcLen == LRG_NO_TRACE) || (srcMbuf == NULLP))
1711 RLOG0(L_ERROR, "Trace Disabled.");
1715 cmMemset((U8 *)&trc, 0, sizeof(RgMngmt));
1717 pst = rgCb[inst].rgInit.lmPst;
1718 pst.selector = rgCb[inst].genCfg.trcResp.response.selector;
1719 pst.prior = rgCb[inst].genCfg.trcResp.response.prior;
1720 pst.route = rgCb[inst].genCfg.trcResp.response.route;
1721 pst.region = rgCb[inst].genCfg.trcResp.response.mem.region;
1722 pst.pool = rgCb[inst].genCfg.trcResp.response.mem.pool;
1724 trc.hdr.transId = rgCb[inst].genCfg.trcResp.transId;
1726 SGetDateTime(&trc.t.trc.dt);
1728 /* Check if the whole buffer is to be sent in Trace indication */
1729 if(rgCb[inst].trcLen == LRG_FULL_TRACE)
1731 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1734 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1737 trc.cfm.status = LCM_PRIM_OK;
1738 trc.cfm.reason = LCM_REASON_NOT_APPL;
1739 trc.t.trc.evnt = event;
1741 /* Send Trace Indication to Layer manager */
1742 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1744 /* check if only a specified number of bytes are to be sent */
1745 else if(rgCb[inst].trcLen > 0)
1747 /* Get the length of the recvd message buffer */
1748 if (SFndLenMsg(srcMbuf, &bufLen) != ROK)
1750 RLOG0(L_ERROR, "SFndLenMsg Failed.");
1753 /* Check if the recvd buffer size is less than request trace len */
1754 if(bufLen < rgCb[inst].trcLen)
1756 /* Copy the whole of the recvd buffer in trace indication */
1758 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1761 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1765 trc.cfm.status = LCM_PRIM_OK;
1766 trc.cfm.reason = LCM_REASON_NOT_APPL;
1767 trc.t.trc.evnt = event;
1769 /* Send Trace Indication to Layer manager */
1770 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1772 /* if the recvd buffer size is greater than request trace len */
1773 if(bufLen >= rgCb[inst].trcLen)
1775 /* Get a temporary buffer to store the msg */
1776 if (rgAllocSBuf(inst,&tempBuf, rgCb[inst].trcLen) != ROK)
1778 RLOG0(L_ERROR, "rgAllocSBuf Failed.");
1782 /* Copy trcLen nos of bytes from the recvd message */
1783 if (SCpyMsgFix(srcMbuf,0,rgCb[inst].trcLen,tempBuf,&tempCnt) != ROK)
1785 RLOG0(L_ERROR, "SCpyMsgFix Failed.");
1789 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
1791 RLOG0(L_ERROR, "dstMbuf Allocation Failed");
1794 /* Copy the tempBuf data to dst mBuf */
1795 if (SCpyFixMsg(tempBuf,dstMbuf,0,rgCb[inst].trcLen,&tempCnt) != ROK)
1797 RLOG0(L_ERROR, "SCpyFixMsg Failed.");
1801 /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
1803 /* Free the memory allocated for tempBuf */
1804 rgFreeSBuf(inst,&tempBuf, rgCb[inst].trcLen);
1806 trc.cfm.status = LCM_PRIM_OK;
1807 trc.cfm.reason = LCM_REASON_NOT_APPL;
1808 trc.t.trc.evnt = event;
1810 /* Send Trace Indication to Layer manager */
1811 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1819 * @brief Layer Manager Control Confirm generation handler
1820 * for Bind Confirm reception at TFU interface.
1821 * RgLiTfuBndCfm() forwards the confirmation to this
1822 * function. All SAP state related handling is restricted
1823 * to LMM modules, hence the cfm forwarding.
1827 * Function : rgLMMBndCfm
1829 * This API is used by the LIM module of MAC to forward
1830 * the Bind Confirm it receives over the TFU interface.
1832 * @param[in] Pst *pst, Post Structure
1833 * @param[in] SuId suId, Service user ID
1834 * @param[in] U8 status, Status
1839 PUBLIC S16 rgLMMBndCfm
1841 Pst *pst, /* Post Structure */
1842 SuId suId, /* Service user ID */
1843 U8 status /* Status */
1846 PUBLIC S16 rgLMMBndCfm(pst,suId,status)
1847 Pst *pst; /* Post Structure */
1848 SuId suId; /* Service user ID */
1849 U8 status; /* Status */
1852 Inst inst = pst->dstInst - RG_INST_START;
1861 /* Check if the suId is valid */
1862 if(rgCb[inst].tfuSap.sapCfg.suId != suId)
1864 RLOG0(L_ERROR, "Invalid SuId");
1868 /* check the Sap State */
1869 switch(rgCb[inst].tfuSap.sapSta.sapState)
1871 case LRG_WAIT_BNDCFM:
1874 /* SAP is already bound */
1880 cfmPst = rgCb[inst].rgInit.lmPst;
1881 cfmPst.selector = rgCb[inst].genCfg.bndCfmResp.response.selector;
1882 cfmPst.prior = rgCb[inst].genCfg.bndCfmResp.response.prior;
1883 cfmPst.route = rgCb[inst].genCfg.bndCfmResp.response.route;
1884 cfmPst.region = rgCb[inst].genCfg.bndCfmResp.response.mem.region;
1885 cfmPst.pool = rgCb[inst].genCfg.bndCfmResp.response.mem.pool;
1887 cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
1891 case CM_BND_OK: /* status is OK */
1892 /* Change SAP state to Bound */
1893 rgCb[inst].tfuSap.sapSta.sapState = LRG_BND;
1894 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1896 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1898 /* Send Control Confirm with status as OK to Layer Manager */
1899 cntrlCfm.cfm.status = LCM_PRIM_OK;
1900 cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
1904 /* Change SAP state to UnBound */
1905 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1906 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1908 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1910 /* Send Control Confirm with status as NOK to Layer Manager */
1911 cntrlCfm.cfm.status = LCM_PRIM_NOK;
1912 cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1915 rgCb[inst].tfuSap.numBndRetries = 0;
1916 cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1917 cntrlCfm.hdr.transId = rgCb[inst].genCfg.bndCfmResp.transId;
1919 ret = RgMiLrgCntrlCfm(&cfmPst, &cntrlCfm);
1926 * @brief LTE MAC timer call back function registered with SSI.
1930 * Function : rgActvTmr
1932 * This function is invoked by SSI for every timer activation
1939 PUBLIC S16 rgActvTmr
1945 PUBLIC S16 rgActvTmr(ent, inst)
1950 Inst macInst = (inst - RG_INST_START);
1953 /* Check if any MAC timer has expired */
1954 cmPrcTmr(&rgCb[macInst].tmrTqCp, rgCb[macInst].tmrTq, (PFV) rgLMMTmrExpiry);
1958 } /* end of rgActvTmr */
1961 * @brief Layer Manager Configuration request handler for Scheduler
1965 * Function : MacSchGenCfgReq
1967 * This function receives general configurations for Scheduler
1968 * from DU APP and forwards to Scheduler.
1970 * @param[in] Pst *pst, the post structure
1971 * @param[in] RgMngmt *cfg, the configuration parameter's structure
1976 PUBLIC int MacSchGenCfgReq
1978 Pst *pst, /* post structure */
1979 RgMngmt *cfg /* config structure */
1982 PUBLIC int MacSchGenCfgReq(pst, cfg)
1983 Pst *pst; /* post structure */
1984 RgMngmt *cfg; /* config structure */
1987 printf("\nReceived Scheduler gen config at MAC");
1988 pst->dstInst = DEFAULT_CELLS + 1;
1989 HandleSchGenCfgReq(pst, cfg);
1995 * @brief Layer Manager Configuration response from Scheduler
1999 * Function : SchSendCfgCfm
2001 * This function sends general configurations response from
2002 * Scheduler to DU APP.
2004 * @param[in] Pst *pst, the post structure
2005 * @param[in] RgMngmt *cfm, the configuration confirm structure
2010 PUBLIC S16 SchSendCfgCfm
2012 Pst *pst, /* post structure */
2013 RgMngmt *cfm /* config confirm structure */
2016 PUBLIC S16 SchSendCfgCfm(pst, cfm)
2017 Pst *pst; /* post structure */
2018 RgMngmt *cfm; /* config confirm structure */
2021 printf("\nSending Scheduler config confirm to DU APP");
2022 pst->dstEnt = ENTDUAPP;
2025 pst->selector = ODU_SELECTOR_LC;
2026 RgMiLrgSchCfgCfm(pst, cfm);
2032 /***********************************************************
2034 * Func : macCellCfgFillCfmPst
2037 * Desc : Fills the Confirmation Post Structure cfmPst
2045 **********************************************************/
2046 Void macCellCfgFillCfmPst
2053 inst = reqPst->dstInst;
2055 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
2056 cfmPst->srcInst = rgCb[inst].rgInit.inst;
2057 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
2059 cfmPst->dstEnt = ENTDUAPP;
2060 cfmPst->dstInst = 0;
2061 cfmPst->dstProcId = cfmPst->srcProcId;
2063 cfmPst->selector = ODU_SELECTOR_LC;
2064 cfmPst->prior = reqPst->prior;
2065 cfmPst->route = reqPst->route;
2066 cfmPst->region = reqPst->region;
2067 cfmPst->pool = reqPst->pool;
2068 cfmPst->event = EVENT_MAC_CELL_CONFIG_CFM;
2074 * @brief Layer Manager Configuration request handler.
2078 * Function : MacHdlCellCfgReq
2080 * This function handles the gNB and cell configuration
2081 * request received from DU APP.
2082 * This API unapcks and forwards the config towards SCH
2084 * @param[in] Pst *pst
2085 * @param[in] MacCellCfg *macCellCfg
2089 int MacHdlCellCfgReq
2092 MacCellCfg *macCellCfg
2098 MacCellCb *macCellCb = NULLP;
2099 Inst inst = pst->dstInst;
2101 cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
2102 MAC_ALLOC(cellCb,sizeof(RgCellCb));
2106 DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n");
2110 memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
2111 rgCb[inst].cell = cellCb;
2113 MAC_ALLOC(macCellCb,sizeof(MacCellCb));
2114 if(macCellCb == NULLP)
2116 DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
2119 memset(macCellCb, 0, sizeof(MacCellCb));
2120 macCb.macCell = macCellCb;
2121 macCb.macCell->cellId = macCellCfg->cellId;
2122 /* Send cell cfg to scheduler */
2123 ret = MacSchCellCfgReq(pst, macCellCfg);
2126 MacCellCfgCfm macCellCfgCfm;
2127 macCellCfgCfm.rsp = RSP_NOK;
2128 macCellCfgCfm.transId = macCellCfg->transId;
2129 macCellCfgFillCfmPst(pst,&cfmPst);
2130 ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
2133 LwrMacEnqueueWlsBlock();
2136 } /* end of MacHdlCellCfgReq */
2139 * @brief Layer Manager Configuration request handler.
2143 * Function : MacSchCellCfgReq
2145 * This function sends cell configuration to SCH
2147 * @param[in] Pst *pst
2148 * @param[in] MacCellCfg *macCellCfg
2152 int MacSchCellCfgReq
2155 MacCellCfg *macCellCfg
2158 SchCellCfg schCellCfg;
2162 cmMemset((U8 *)&cfgPst, 0, sizeof(Pst));
2163 schCellCfg.cellId = macCellCfg->cellId;
2164 schCellCfg.phyCellId = macCellCfg->phyCellId;
2165 schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
2166 schCellCfg.dupMode = macCellCfg->dupType;
2168 /* fill ssb scheduler parameters */
2169 schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
2170 schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
2171 schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
2172 schCellCfg.ssbSchCfg.ssbPeriod = macCellCfg->ssbCfg.ssbPeriod;
2173 schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
2174 for(uint8_t idx=0; idx<SSB_MASK_SIZE; idx++)
2176 schCellCfg.ssbSchCfg.nSSBMask[idx] = macCellCfg->ssbCfg.ssbMask[idx];
2179 /* fill SIB1 scheduler parameters */
2180 schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen;
2181 schCellCfg.sib1SchCfg.sib1NewTxPeriod = macCellCfg->sib1Cfg.sib1NewTxPeriod;
2182 schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod;
2183 schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex;
2184 schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex;
2185 schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs;
2187 /* fill RACH config params */
2188 schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
2189 schCellCfg.schRachCfg.prachSubcSpacing = \
2190 macCellCfg->prachCfg.prachSubcSpacing;
2191 schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
2192 schCellCfg.schRachCfg.msg1Fdm = macCellCfg->prachCfg.msg1Fdm;
2193 schCellCfg.schRachCfg.rootSeqLen = macCellCfg->prachCfg.rootSeqLen;
2194 schCellCfg.schRachCfg.rootSeqIdx = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
2195 schCellCfg.schRachCfg.numRootSeq = macCellCfg->prachCfg.fdm[0].numRootSeq;
2196 schCellCfg.schRachCfg.k1 = macCellCfg->prachCfg.fdm[0].k1;
2197 schCellCfg.schRachCfg.ssbPerRach = macCellCfg->prachCfg.ssbPerRach;
2198 schCellCfg.schRachCfg.prachMultCarrBand = \
2199 macCellCfg->prachCfg.prachMultCarrBand;
2200 schCellCfg.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr;
2201 schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
2202 schCellCfg.schRachCfg.raRspWindow = macCellCfg->prachCfg.raRspWindow;
2204 /* fill initial DL BWP */
2205 schCellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
2206 schCellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
2207 schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
2208 schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
2209 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
2210 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
2211 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
2212 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
2213 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
2214 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
2215 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
2216 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
2217 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
2218 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
2219 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
2220 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
2221 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
2222 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
2223 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
2224 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
2225 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
2226 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
2227 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
2228 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
2229 schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
2230 schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
2231 macCellCfg->initialDlBwp.pdschCommon.mappingType;
2232 schCellCfg.schInitialDlBwp.pdschCommon.startSymbol =
2233 macCellCfg->initialDlBwp.pdschCommon.startSymbol;
2234 schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol =
2235 macCellCfg->initialDlBwp.pdschCommon.lengthSymbol;
2237 /* fill initial UL BWP */
2238 schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
2239 schCellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
2240 schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
2241 schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
2242 schCellCfg.schInitialUlBwp.puschCommon.k2 = macCellCfg->initialUlBwp.puschCommon.k2;
2243 schCellCfg.schInitialUlBwp.puschCommon.mappingType =
2244 macCellCfg->initialUlBwp.puschCommon.mappingType;
2245 schCellCfg.schInitialUlBwp.puschCommon.startSymbol =
2246 macCellCfg->initialUlBwp.puschCommon.startSymbol;
2247 schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol =
2248 macCellCfg->initialUlBwp.puschCommon.lengthSymbol;
2251 cfgPst.srcProcId = pst->dstProcId;
2252 cfgPst.dstProcId = pst->srcProcId;
2253 cfgPst.srcEnt = ENTRG;
2255 cfgPst.dstEnt = ENTRG;
2257 cfgPst.selector = ODU_SELECTOR_TC;
2258 cfgPst.event = EVENT_SCH_CELL_CFG;
2260 ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg);
2262 } /* end of MacSchCellCfgReq */
2265 /*******************************************************************
2267 * @brief Sends Cell config confirm to DU APP
2271 * Function : MacSendCellCfgCfm
2274 * Sends Cell config confirm to DU APP
2276 * @params[in] Response status
2279 * ****************************************************************/
2280 void MacSendCellCfgCfm(uint8_t response)
2284 MacCellCfgCfm macCellCfgCfm;
2286 cmMemset((U8 *)&pst, 0, sizeof(Pst));
2287 cellCb = rgCb[macCb.macInst].cell;
2289 macCellCfgCfm.transId = cellCb->macCellCfg.transId;
2290 macCellCfgCfm.rsp = response;
2292 memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
2293 pst.event = EVENT_MAC_CELL_CONFIG_CFM;
2294 (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
2299 * @brief Layer Manager Configuration response handler.
2303 * Function : MacProcSchCellCfgCfm
2305 * This function processes cell configuration to SCH
2307 * @param[in] Pst *pst
2308 * @param[in] SchCellCfgCfm *schCellCfgCfm
2312 int MacProcSchCellCfgCfm
2315 SchCellCfgCfm *schCellCfgCfm
2318 if(schCellCfgCfm->rsp == RSP_OK)
2320 sendToLowerMac(CONFIG_REQUEST, 0, (void *)NULL);
2324 MacSendCellCfgCfm(RSP_NOK);
2329 /**********************************************************************
2332 **********************************************************************/