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) */
42 #include "envopt.h" /* environment options */
43 #include "envdep.h" /* environment dependent */
44 #include "envind.h" /* environment independent */
45 #include "gen.h" /* general */
46 #include "ssi.h" /* system services */
47 #include "cm_tkns.h" /* Common Token Defines */
48 #include "cm_llist.h" /* Common Link List Defines */
49 #include "cm_hash.h" /* Common Hash List Defines */
50 #include "cm_mblk.h" /* common memory link list library */
51 #include "cm_lte.h" /* Common LTE Defines */
52 #include "rg_env.h" /* MAC Environment Defines */
53 #include "crg.h" /* CRG Interface defines */
54 #include "rgu.h" /* RGU Interface defines */
55 #include "tfu.h" /* RGU Interface defines */
56 #include "rg_sch_inf.h" /* RGR Interface defines */
57 #include "lrg.h" /* LRG Interface defines */
58 #include "rgr.h" /* LRG Interface defines */
59 #include "rg.h" /* MAC defines */
60 #include "rg_err.h" /* MAC error defines */
63 /* header/extern include files (.x) */
64 #include "gen.x" /* general */
65 #include "ssi.x" /* system services */
66 #include "cm5.x" /* system services */
67 #include "cm_tkns.x" /* Common Token Definitions */
68 #include "cm_llist.x" /* Common Link List Definitions */
69 #include "cm_lib.x" /* Common Library Definitions */
70 #include "cm_hash.x" /* Common Hash List Definitions */
71 #include "cm_mblk.x" /* common memory link list library */
72 #include "cm_lte.x" /* Common LTE Defines */
73 #include "crg.x" /* CRG Interface includes */
74 #include "rgu.x" /* RGU Interface includes */
75 #include "tfu.x" /* RGU Interface includes */
76 #include "rg_sch_inf.x" /* SCH Interface includes */
77 #include "rg_prg.x" /* PRG Interface includes */
78 #include "lrg.x" /* LRG Interface includes */
79 #include "rgr.x" /* LRG Interface includes */
80 #include "du_app_mac_inf.h"
81 #include "rg.x" /* MAC includes */
83 #include "ss_diag.h" /* Common log file */
87 #include "lwr_mac.h" /* MAC CL defines */
89 #include "lwr_mac_phy.h"
90 #include "lwr_mac_fsm.h"
94 #endif /* __cplusplus */
95 EXTERN Void rgGetSId ARGS((SystemId *s));
98 #endif /* __cplusplus */
100 /* Public variable declaration */
104 int MacSchCellCfgReq(Pst *pst,MacCellCfg *macCellCfg);
106 /* forward references */
107 PRIVATE U16 rgLMMGenCfg ARGS((
112 PRIVATE U16 rgLMMSapCfg ARGS((
118 PRIVATE Void rgLMMShutdown ARGS((
122 PRIVATE Void rgLMMFillCfmPst ARGS((
128 PRIVATE Void rgLMMGenCntrl ARGS((
134 PRIVATE Void rgLMMSapCntrl ARGS((
140 extern int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
142 packMacCellCfgConfirm packMacCellCfmOpts[] =
144 packMacCellCfgCfm, /* packing for loosely coupled */
145 duHandleMacCellCfgCfm, /* packing for tightly coupled */
146 packMacCellCfgCfm, /* packing for light weight loosly coupled */
149 SchCellCfgFunc SchCellCfgOpts[] =
151 packSchCellCfg, /* packing for loosely coupled */
152 SchHdlCellCfgReq, /* packing for tightly coupled */
153 packSchCellCfg /* packing for light weight loosly coupled */
158 * @brief Task Initiation callback function.
162 * Function : rgActvInit
164 * This function is supplied as one of parameters during MAC's
165 * task registration. SSI will invoke this function once, after
166 * it creates and attaches this TAPA Task to a system task.
168 * @param[in] Ent entity, the entity ID of this task.
169 * @param[in] Inst inst, the instance ID of this task.
170 * @param[in] Region region, the region ID registered for memory
171 * usage of this task.
172 * @param[in] Reason reason.
177 PUBLIC S16 rgActvInit
179 Ent entity, /* entity */
180 Inst inst, /* instance */
181 Region region, /* region */
182 Reason reason /* reason */
185 PUBLIC S16 rgActvInit(entity, inst, region, reason)
186 Ent entity; /* entity */
187 Inst inst; /* instance */
188 Region region; /* region */
189 Reason reason; /* reason */
195 RG_IS_INST_VALID(inst);
197 macInst = inst - RG_INST_START;
198 /* Initialize the MAC TskInit structure to zero */
199 cmMemset ((U8 *)&rgCb[macInst], 0, sizeof(RgCb));
201 /* Initialize the MAC TskInit with received values */
202 rgCb[macInst].rgInit.ent = entity;
203 rgCb[macInst].rgInit.inst = inst;
204 rgCb[macInst].rgInit.region = region;
205 rgCb[macInst].rgInit.pool = 0;
206 rgCb[macInst].rgInit.reason = reason;
207 rgCb[macInst].rgInit.cfgDone = FALSE;
208 rgCb[macInst].rgInit.acnt = FALSE;
209 rgCb[macInst].rgInit.usta = FALSE;
210 rgCb[macInst].rgInit.trc = FALSE;
211 rgCb[macInst].trcLen = 0;
214 /* disabling debugs by default */
215 rgCb[macInst].rgInit.dbgMask = 0xffffffff;
219 rgCb[macInst].rgInit.logMask = 0x0;
221 rgCb[macInst].rgInit.procId = SFndProcId();
222 rgCb[macInst].tfuSap.numBndRetries = 0;
224 /* Initialize Sap state */
225 rgCb[macInst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
226 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
227 rgCb[macInst].rguSap = NULLP;
228 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
230 rgCb[macInst].inactiveCell = NULLP;
231 rgCb[macInst].cell = NULLP;
233 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULMAC,SS_RNG_TX);
234 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULRLC,SS_RNG_RX);
237 /* Initializing CL control block */
238 clGlobalCp.region = region;
240 clGlobalCp.clCfgDone = FALSE;
241 clGlobalCp.numOfCells = 0;
242 clGlobalCp.phyState = PHY_STATE_IDLE;
244 if( cmHashListInit(&clGlobalCp.cellCbLst, MAX_NUM_CELL_SUPP, 0x0, FALSE,
245 CM_HASH_KEYTYPE_DEF, clGlobalCp.region, clGlobalCp.pool ) != ROK )
247 printf("\n Cellcb hash list initialization failed for MAC CL");
251 /* Initialize Scheduler as well */
252 schActvInit(ENTRG, (DEFAULT_CELLS + SCH_INST_START), DFLT_REGION, PWR_UP);
254 /* Initialize lower mac */
262 * @brief Layer Manager Configuration request handler.
266 * Function : RgMiLrgCfgReq
268 * This function handles the configuration
269 * request received from the Layer Manager.
270 * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the
271 * functions rgHdlGenCfg() or rgHdlSapCfg().
272 * -# Invokes RgMiLrgCfgCfm() to send back the confirmation to the LM.
274 * @param[in] Pst *pst, the post structure
275 * @param[in] RgMngmt *cfg, the configuration parameter's structure
280 PUBLIC S16 RgMiLrgCfgReq
282 Pst *pst, /* post structure */
283 RgMngmt *cfg /* config structure */
286 PUBLIC S16 RgMiLrgCfgReq(pst, cfg)
287 Pst *pst; /* post structure */
288 RgMngmt *cfg; /* config structure */
291 U16 ret = LCM_PRIM_OK;
292 U16 reason = LCM_REASON_NOT_APPL;
300 RG_DIAG_LVL0(inst,0x0a0b0001, RG_DIAG_NA, SS_DIAG_INV_ARG,
301 "Received CfgReq for MAC layer, Entity = %d, Instance = %d\n",
302 pst->srcEnt, pst->srcInst,0,0);
304 RG_IS_INST_VALID(pst->dstInst);
305 inst = pst->dstInst - RG_INST_START;
307 /* Fill the post structure for sending the confirmation */
308 rgLMMFillCfmPst(pst, &cfmPst, cfg);
310 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
313 cfm.hdr.transId = cfg->hdr.transId;
317 cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt;
318 switch(cfg->hdr.elmId.elmnt)
321 reason = rgLMMGenCfg(inst,&cfg->t.cfg);
326 reason = rgLMMSapCfg(inst,&cfg->t.cfg, cfg->hdr.elmId.elmnt);
330 reason = LCM_REASON_INVALID_ELMNT;
331 RLOG1(L_ERROR, "Invalid Elmnt=%d",
332 cfg->hdr.elmId.elmnt);
336 if (reason != LCM_REASON_NOT_APPL)
341 cfm.cfm.status = ret;
342 cfm.cfm.reason = reason;
344 RgMiLrgCfgCfm(&cfmPst, &cfm);
347 }/*-- RgMiLrgCfgReq --*/
351 * @brief Layer Manager Statistics request handler.
355 * Function : RgMiLrgStsReq
357 * This function handles the statistics
358 * request received from the Layer Manager.
359 * -# Based on sts->hdr.elmId.elmnt, it retrieves either general or SAP
360 * statistics from the rgCb global control block.
361 * -# If action=ARST, it will reset the statistics parameters in rgCb to 0.
362 * -# Invokes the RgMiLrgStsCfm to send back the confirmation to LM.
364 * @param[in] Pst *pst, the post structure
365 * @param[in] RgMngmt *sts, the statistics parameter's structure
370 PUBLIC S16 RgMiLrgStsReq
372 Pst *pst, /* post structure */
373 RgMngmt *sts /* statistics structure */
376 PUBLIC S16 RgMiLrgStsReq(pst, sts)
377 Pst *pst; /* post structure */
378 RgMngmt *sts; /* statistics structure */
388 RG_IS_INST_VALID(pst->dstInst);
389 inst = pst->dstInst - RG_INST_START;
390 /* Fill the post structure for sending the confirmation */
391 rgLMMFillCfmPst(pst, &cfmPst, sts);
393 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
396 cfm.hdr.transId = sts->hdr.transId;
398 SGetDateTime(&cfm.t.sts.dt);
399 cfm.cfm.status = LCM_PRIM_OK;
400 cfm.cfm.reason = LCM_REASON_NOT_APPL;
401 cfm.hdr.elmId.elmnt = sts->hdr.elmId.elmnt;
402 cfm.t.sts.action = sts->t.sts.action;
404 /* Check if General Config Done */
405 if(rgCb[inst].rgInit.cfgDone != TRUE)
407 cfm.cfm.status = LCM_PRIM_NOK;
408 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
409 RgMiLrgStsCfm(&cfmPst,&cfm);
410 RLOG0(L_ERROR, "Gen Cfg not done");
414 switch(sts->hdr.elmId.elmnt)
418 cmMemcpy((U8 *)&(cfm.t.sts.s.genSts), (U8 *)&rgCb[inst].genSts,
420 /* check if action is read and reset */
421 if(sts->t.sts.action == ARST)
423 rgCb[inst].genSts.numHarqFail = 0;
428 RgGenSts *genSts = &(cfm.t.sts.s.genSts);
430 for(cqi=0; cqi <= 14; cqi++)
432 /* Filling DL ACK/NACK stats */
433 genSts->nackAckStats.dlCqiStat[cqi].mcs = \
434 hqFailStats.dlCqiStat[cqi].mcs;
435 genSts->nackAckStats.dlCqiStat[cqi].numOfNacks = \
436 hqFailStats.dlCqiStat[cqi].numOfNacks;
437 genSts->nackAckStats.dlCqiStat[cqi].numOfAcks =
438 hqFailStats.dlCqiStat[cqi].numOfAcks;
440 /* Filling UL ACK/NACK stats */
441 genSts->nackAckStats.ulCqiStat[cqi].mcs = \
442 hqFailStats.ulCqiStat[cqi].mcs;
443 genSts->nackAckStats.ulCqiStat[cqi].numOfNacks = \
444 hqFailStats.ulCqiStat[cqi].numOfNacks;
445 genSts->nackAckStats.ulCqiStat[cqi].numOfAcks = \
446 hqFailStats.ulCqiStat[cqi].numOfAcks;
448 /* Filling DL HQ Retx stats */
449 genSts->hqRetxStats.dlCqiStat[cqi].mcs = \
450 hqRetxStats.dlCqiStat[cqi].mcs;
451 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_1 = \
452 hqRetxStats.dlCqiStat[cqi].numOfHQ_1;
453 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_2 = \
454 hqRetxStats.dlCqiStat[cqi].numOfHQ_2;
455 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_3 = \
456 hqRetxStats.dlCqiStat[cqi].numOfHQ_3;
457 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_4 = \
458 hqRetxStats.dlCqiStat[cqi].numOfHQ_4;
459 genSts->hqRetxStats.dlCqiStat[cqi].totalTx = \
460 hqRetxStats.dlCqiStat[cqi].totalTx;
462 /* Filling UL HQ Retx stats */
463 genSts->hqRetxStats.ulCqiStat[cqi].mcs = \
464 hqRetxStats.ulCqiStat[cqi].mcs;
465 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_1 = \
466 hqRetxStats.ulCqiStat[cqi].numOfHQ_1;
467 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_2 = \
468 hqRetxStats.ulCqiStat[cqi].numOfHQ_2;
469 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_3 = \
470 hqRetxStats.ulCqiStat[cqi].numOfHQ_3;
471 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_4 = \
472 hqRetxStats.ulCqiStat[cqi].numOfHQ_4;
473 genSts->hqRetxStats.ulCqiStat[cqi].totalTx = \
474 hqRetxStats.ulCqiStat[cqi].totalTx;
476 /* Reset statistics */
477 if(sts->t.sts.action == ZEROSTS)
479 cmMemset((U8 *)&hqRetxStats, 0, \
480 sizeof(RgSchHqRetxStats));
481 cmMemset((U8 *)&hqFailStats, 0, \
482 sizeof(RgSchNackAckStats));
485 #endif /* MAC_SCH_STATS*/
489 cmMemcpy((U8 *)&(cfm.t.sts.s.rguSts), (U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts,
492 /* check if action is read and reset */
493 if(sts->t.sts.action == ARST)
494 cmMemset((U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts, 0, sizeof(RgSapSts));
498 cmMemcpy((U8 *)&(cfm.t.sts.s.crgSts), (U8 *)&rgCb[inst].crgSap.sapSts,
501 /* check if action is read and reset */
502 if(sts->t.sts.action == ARST)
503 cmMemset((U8 *)&rgCb[inst].crgSap.sapSts, 0, sizeof(RgSapSts));
507 cmMemcpy((U8 *)&(cfm.t.sts.s.tfuSts), (U8 *)&rgCb[inst].tfuSap.sapSts,
510 /* check if action is read and reset */
511 if(sts->t.sts.action == ARST)
512 cmMemset((U8 *)&rgCb[inst].tfuSap.sapSts, 0, sizeof(RgSapSts));
516 cfm.cfm.status = LCM_PRIM_NOK;
517 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
518 RLOG1(L_ERROR, "Invalid Elmnt = %d",sts->hdr.elmId.elmnt);
521 RgMiLrgStsCfm(&cfmPst,&cfm);
523 }/*-- RgMiLrgStsReq --*/
527 * @brief Layer Manager Status request handler.
531 * Function : RgMiLrgStaReq
533 * This function handles the solicited status
534 * request received from the Layer Manager.
535 * -# Based on sta->hdr.elmId.elmnt, it retrieves the status of a
536 * particular SAP from the rgCb global control block.
537 * -# Invokes the RgMiLrgStaCfm to send back the confirmation to LM.
539 * @param[in] Pst *pst, the post structure
540 * @param[in] RgMngmt *sta, the status parameter's structure
545 PUBLIC S16 RgMiLrgStaReq
547 Pst *pst, /* post structure */
548 RgMngmt *sta /* status structure */
551 PUBLIC S16 RgMiLrgStaReq(pst, sta)
552 Pst *pst; /* post structure */
553 RgMngmt *sta; /* status structure */
563 RG_IS_INST_VALID(pst->dstInst);
564 inst = pst->dstInst - RG_INST_START;
567 /* Fill the post structure for sending the confirmation */
568 rgLMMFillCfmPst(pst, &cfmPst, sta);
570 if (sta->t.ssta.s.sysId.ptNmb != NULLP)
572 SPutSBuf(pst->region, pst->pool, (Data *)sta->t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
575 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
576 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
579 cfm.hdr.transId = sta->hdr.transId;
581 /* Check if General Config Done */
582 if(rgCb[inst].rgInit.cfgDone != TRUE)
584 SGetDateTime(&cfm.t.ssta.dt);
585 if (SGetSBuf(cfmPst.region, cfmPst.pool,
586 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
589 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
592 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
593 rgGetSId(&cfm.t.ssta.s.sysId);
594 cfm.cfm.status = LCM_PRIM_NOK;
595 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
596 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
597 RgMiLrgStaCfm(&cfmPst, &cfm);
598 RLOG0(L_ERROR, "Gen Cfg not done");
602 switch(sta->hdr.elmId.elmnt)
605 SGetDateTime(&cfm.t.ssta.dt);
606 if (SGetSBuf(cfmPst.region, cfmPst.pool,
607 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
610 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
613 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
614 rgGetSId(&cfm.t.ssta.s.sysId);
615 cfm.cfm.status = LCM_PRIM_OK;
616 cfm.cfm.reason = LCM_REASON_NOT_APPL;
617 RgMiLrgStaCfm(&cfmPst, &cfm);
620 cfm.cfm.status = LCM_PRIM_OK;
621 cfm.cfm.reason = LCM_REASON_NOT_APPL;
622 SGetDateTime(&cfm.t.ssta.dt);
623 cmMemcpy((U8 *)&(cfm.t.ssta.s.rguSapSta),
624 (U8 *)&rgCb[inst].rguSap[sta->t.ssta.sapInst].sapSta,
626 RgMiLrgStaCfm(&cfmPst, &cfm);
629 cfm.cfm.status = LCM_PRIM_OK;
630 cfm.cfm.reason = LCM_REASON_NOT_APPL;
631 SGetDateTime(&cfm.t.ssta.dt);
632 cmMemcpy((U8 *)&(cfm.t.ssta.s.crgSapSta), (U8 *)&rgCb[inst].crgSap.sapSta,
634 RgMiLrgStaCfm(&cfmPst, &cfm);
637 cfm.cfm.status = LCM_PRIM_OK;
638 cfm.cfm.reason = LCM_REASON_NOT_APPL;
639 SGetDateTime(&cfm.t.ssta.dt);
640 cmMemcpy((U8 *)&(cfm.t.ssta.s.tfuSapSta), (U8 *)&rgCb[inst].tfuSap.sapSta,
642 RgMiLrgStaCfm(&cfmPst, &cfm);
645 cfm.cfm.status = LCM_PRIM_NOK;
646 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
647 RgMiLrgStaCfm(&cfmPst, &cfm);
648 RLOG1(L_ERROR, "Invalid elmnt=%d",sta->hdr.elmId.elmnt);
652 }/*-- RgMiLrgStaReq --*/
656 * @brief Layer Manager Control request handler.
660 * Function : RgMiLrgCntrlReq
662 * This function handles the control
663 * request received from the Layer Manager.
664 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
665 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
666 * of SAP (enable/disable), Debug (enable/disable), Trace (enable/disable)
667 * and layer shutdown.
668 * -# Invokes the RgMiLrgCntrlCfm to send back the confirmation to LM.
670 * @param[in] Pst *pst, the post structure
671 * @param[in] RgMngmt *cntrl, the control parameter's structure
676 PUBLIC S16 RgMiLrgCntrlReq
678 Pst *pst, /* post structure */
679 RgMngmt *cntrl /* control structure */
682 PUBLIC S16 RgMiLrgCntrlReq(pst, cntrl)
683 Pst *pst; /* post structure */
684 RgMngmt *cntrl; /* control structure */
687 S16 ret = ROK; /* return value */
692 TRC2(RgMiLrgCntrlReq)
694 /* Fill the post structure for sending the confirmation */
696 RG_IS_INST_VALID(pst->dstInst);
697 inst = pst->dstInst - RG_INST_START;
699 rgLMMFillCfmPst(pst, &cfmPst, cntrl);
701 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
703 cfm.hdr.transId = cntrl->hdr.transId;
705 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
706 cfm.t.cntrl.action = cntrl->t.cntrl.action;
707 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
709 /* Check if General Config Done*/
710 if(rgCb[inst].rgInit.cfgDone != TRUE)
712 cfm.cfm.status = LCM_PRIM_NOK;
713 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
714 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
715 RgMiLrgCntrlCfm(&cfmPst, &cfm);
716 RLOG0(L_ERROR, "Gen Cfg not done");
720 /* General Config done, process the Control request */
721 switch(cntrl->hdr.elmId.elmnt)
724 rgLMMGenCntrl(cntrl, &cfm, &cfmPst);
729 rgLMMSapCntrl(cntrl, &cfm, &cfmPst);
732 cfm.cfm.status = LCM_PRIM_NOK;
733 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
734 RgMiLrgCntrlCfm(&cfmPst, &cfm);
735 RLOG1(L_ERROR, "invalid elmnt=%d",cntrl->hdr.elmId.elmnt);
739 }/*-- RgMiLrgCntrlReq --*/
743 * @brief SAP Configuration Handler.
747 * Function : rgLMMSapCfg
749 * This function in called by RgMiLrgCfgReq(). It handles the
750 * interface SAP configuration of the LTE MAC layer. It
751 * initializes the sapState to LRG_UNBND. Returns
752 * reason for success/failure of this function.
754 * @param[in] Inst inst
755 * @param[in] RgCfg *cfg, the Configuaration information
757 * -# LCM_REASON_GENCFG_NOT_DONE
758 * -# LCM_REASON_INVALID_SAP
759 * -# LCM_REASON_NOT_APPL
762 PRIVATE U16 rgLMMSapCfg
765 RgCfg *cfg, /* Configuaration information */
766 Elmnt sapType /* Sap Type */
769 PRIVATE U16 rgLMMSapCfg(inst,cfg,sapType)
771 RgCfg *cfg; /* Configuaration information */
772 Elmnt sapType; /* Sap Type */
775 U16 ret = LCM_REASON_NOT_APPL;
776 RgLowSapCfgInfo *lowSapCfg = NULLP;
777 RgUpSapCfgInfo *upSapCfg = NULLP;
778 RgUpSapCb *upSapCb = NULLP;
782 /* Check if Gen Config has been done */
783 if(rgCb[inst].rgInit.cfgDone != TRUE)
784 RETVALUE(LCM_REASON_GENCFG_NOT_DONE);
789 if ((cfg->s.rguSap.spId > LRG_MAX_RGU_SAPS) &&
790 (cfg->s.rguSap.selector != RGU_SEL_TC) &&
791 (cfg->s.rguSap.selector != RGU_SEL_LC))
793 ret = LCM_REASON_INVALID_PAR_VAL;
794 RLOG0(L_ERROR, "unsupported Selector value for RGU");
797 upSapCb = &(rgCb[inst].rguSap[cfg->s.rguSap.spId]);
798 if(upSapCb->sapSta.sapState == LRG_NOT_CFG)
800 upSapCb->sapSta.sapState = LRG_UNBND;
802 upSapCfg = &(upSapCb->sapCfg);
803 upSapCfg->sapPst.dstEnt = cfg->s.rguSap.ent;
804 upSapCfg->sapPst.dstInst = cfg->s.rguSap.inst;
805 upSapCfg->sapPst.dstProcId = cfg->s.rguSap.procId;
806 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
807 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
808 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
809 upSapCfg->sapPst.region = cfg->s.rguSap.mem.region;
810 upSapCfg->sapPst.pool = cfg->s.rguSap.mem.pool;
811 upSapCfg->sapPst.selector = cfg->s.rguSap.selector;
812 upSapCfg->sapPst.route = cfg->s.rguSap.route;
813 upSapCfg->sapPst.intfVer = 0;
814 upSapCfg->sapPst.prior = cfg->s.rguSap.prior;
815 upSapCfg->suId = cfg->s.rguSap.suId;
816 upSapCfg->spId = cfg->s.rguSap.spId;
817 /*T2K uses 2 saps, T3K uses 1 sap. change the rgRguDlSap to 1 only if
818 * there is cfg request with sap is 1*/
821 if ((cfg->s.crgSap.selector != CRG_SEL_TC) &&
822 (cfg->s.crgSap.selector != CRG_SEL_LC))
824 ret = LCM_REASON_INVALID_PAR_VAL;
825 RLOG0(L_ERROR, "unsupported Selector value for CRG");
828 if(rgCb[inst].crgSap.sapSta.sapState == LRG_NOT_CFG)
830 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
832 upSapCfg = &rgCb[inst].crgSap.sapCfg;
834 upSapCfg->sapPst.dstEnt = cfg->s.crgSap.ent;
835 upSapCfg->sapPst.dstInst = cfg->s.crgSap.inst;
836 upSapCfg->sapPst.dstProcId = cfg->s.crgSap.procId;
837 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
838 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
839 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
840 upSapCfg->sapPst.region = cfg->s.crgSap.mem.region;
841 upSapCfg->sapPst.pool = cfg->s.crgSap.mem.pool;
842 upSapCfg->sapPst.selector = cfg->s.crgSap.selector;
843 upSapCfg->sapPst.route = cfg->s.crgSap.route;
844 upSapCfg->sapPst.intfVer = 0;
845 upSapCfg->sapPst.prior = cfg->s.crgSap.prior;
846 upSapCfg->suId = cfg->s.crgSap.suId;
847 upSapCfg->spId = cfg->s.crgSap.spId;
851 if ((cfg->s.tfuSap.selector != TFU_SEL_TC) &&
852 (cfg->s.tfuSap.selector != TFU_SEL_LC))
854 ret = LCM_REASON_INVALID_PAR_VAL;
855 RLOG0(L_ERROR, "unsupported Selector value for TFU");
859 if (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG)
861 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
863 lowSapCfg = &rgCb[inst].tfuSap.sapCfg;
865 lowSapCfg->sapPst.dstEnt = cfg->s.tfuSap.ent;
866 lowSapCfg->sapPst.dstInst = cfg->s.tfuSap.inst;
867 lowSapCfg->sapPst.dstProcId = rgCb[inst].rgInit.procId;
868 lowSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
869 lowSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
870 lowSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
871 lowSapCfg->sapPst.region = cfg->s.tfuSap.mem.region;
872 lowSapCfg->sapPst.pool = cfg->s.tfuSap.mem.pool;
873 lowSapCfg->sapPst.selector = cfg->s.tfuSap.selector;
874 lowSapCfg->sapPst.route = cfg->s.tfuSap.route;
875 lowSapCfg->sapPst.intfVer = 0;
876 lowSapCfg->sapPst.prior = cfg->s.tfuSap.prior;
877 lowSapCfg->suId = cfg->s.tfuSap.suId;
878 lowSapCfg->spId = cfg->s.tfuSap.spId;
879 cmMemcpy((U8 *)&lowSapCfg->bndTmr, (U8 *)&cfg->s.tfuSap.bndTmr,
883 /* would never reach here */
891 * @brief General Configuration Handler.
895 * Function : rgLMMGenCfg
897 * This function in called by RgMiLrgCfgReq(). It handles the
898 * general configuration of the LTE MAC layer. It initializes
899 * the hash lists of RgCb. Returns
900 * reason for success/failure of this function.
902 * @param[in] Inst inst
903 * @param[in] RgCfg *cfg, the Configuaration information
905 * -# LCM_REASON_NOT_APPL
906 * -# LCM_REASON_INVALID_MSGTYPE
907 * -# LCM_REASON_MEM_NOAVAIL
910 PRIVATE U16 rgLMMGenCfg
913 RgCfg *cfg /* Configuaration information */
916 PRIVATE U16 rgLMMGenCfg(inst,cfg)
918 RgCfg *cfg; /* Configuaration information */
921 U16 ret = LCM_REASON_NOT_APPL;
925 /* Check if General Configuration is done already */
926 if (rgCb[inst].rgInit.cfgDone == TRUE)
928 RETVALUE(LCM_REASON_INVALID_MSGTYPE);
930 if ((cfg->s.genCfg.lmPst.selector != LRG_SEL_TC) &&
931 (cfg->s.genCfg.lmPst.selector != LRG_SEL_LC))
933 RLOG0(L_ERROR, "unsupported Selector value for RGU");
934 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
936 /* Update the Pst structure for LM interface */
937 cmMemcpy((U8 *)&rgCb[inst].rgInit.lmPst, (U8 *)&cfg->s.genCfg.lmPst,
940 rgCb[inst].rgInit.lmPst.srcProcId = rgCb[inst].rgInit.procId;
941 rgCb[inst].rgInit.lmPst.srcEnt = rgCb[inst].rgInit.ent;
942 rgCb[inst].rgInit.lmPst.srcInst = rgCb[inst].rgInit.inst;
943 rgCb[inst].rgInit.lmPst.event = EVTNONE;
945 rgCb[inst].rgInit.region = cfg->s.genCfg.mem.region;
946 rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool;
947 rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes;
949 macCb.macInst = rgCb[inst].rgInit.inst;
951 /* Initialize SAP States */
952 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
954 if(cfg->s.genCfg.numRguSaps == 0)
956 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Invalid numRguSap.\n"));
960 /* allocate RGR saps */
961 if (SGetSBuf(rgCb[inst].rgInit.region,
962 rgCb[inst].rgInit.pool,
963 (Data **)&rgCb[inst].rguSap,
964 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps)) != ROK)
966 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Failed to allocate mem for RGU SAP's.\n"));
969 rgCb[inst].numRguSaps = cfg->s.genCfg.numRguSaps;
971 for (int idx = 0; idx < rgCb[inst].numRguSaps; idx++)
973 rgCb[inst].rguSap[idx].sapSta.sapState = LRG_NOT_CFG;
974 cmMemset((U8 *)&rgCb[inst].rguSap[idx], 0, sizeof(RgUpSapCb));
976 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
977 /* Initialize the timer blocks */
978 cmInitTimers(rgCb[inst].tmrBlk, RG_MAX_TIMER);
979 /* Initialzie the timer queue */
980 cmMemset((U8 *)&rgCb[inst].tmrTq, 0, sizeof(CmTqType)*RG_TQ_SIZE);
981 /* Initialize the timer control point */
982 cmMemset((U8 *)&rgCb[inst].tmrTqCp, 0, sizeof(CmTqCp));
983 rgCb[inst].tmrTqCp.tmrLen = RG_TQ_SIZE;
985 /* Timer Registration request to SSI */
986 if (SRegTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
987 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr) != ROK)
990 RLOG0(L_ERROR, "Failed to register timer");
992 SPutSBuf(rgCb[inst].rgInit.region,
993 rgCb[inst].rgInit.pool,
994 (Data *)rgCb[inst].rguSap,
995 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps));
997 RETVALUE(LCM_REASON_MEM_NOAVAIL);
1000 /* Set Config done in TskInit */
1001 rgCb[inst].rgInit.cfgDone = TRUE;
1007 /***********************************************************
1009 * Func : rgLMMShutdown
1012 * Desc : Handles the MAC layer shutdown request. Calls
1013 * rgCFGFreeCellCb(RgCellCb*) to handle each cellCb deallocation.
1022 **********************************************************/
1024 PRIVATE Void rgLMMShutdown
1029 PRIVATE Void rgLMMShutdown(inst)
1033 RgCellCb *cell = rgCb[inst].cell;
1038 /* Unbind the TFU Sap */
1039 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM)
1041 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1042 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1044 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1046 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1048 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_BND)
1050 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1051 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1057 for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
1059 rgTOMRlsSf(inst,&cell->subFrms[idx]);
1062 rgCFGFreeCellCb(cell);
1065 /* Deleting the RGU SAPs */
1066 SPutSBuf(rgCb[inst].rgInit.region,
1067 rgCb[inst].rgInit.pool,
1068 (Data *)rgCb[inst].rguSap,
1069 (sizeof(RgUpSapCb) * rgCb[inst].numRguSaps));
1070 rgCb[inst].rguSap = NULLP;
1072 rgCb[inst].inactiveCell = NULLP;
1073 rgCb[inst].cell = NULLP;
1075 /* De-register the Timer Service */
1076 (Void) SDeregTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
1077 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr);
1079 /* call back the task initialization function to intialize
1080 * the global RgCb Struct */
1081 rgActvInit(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, rgCb[inst].rgInit.region,
1082 rgCb[inst].rgInit.reason);
1088 /***********************************************************
1090 * Func : rgLMMGenCntrl
1093 * Desc : Processes the LM control request for STGEN elmnt.
1102 **********************************************************/
1104 PRIVATE Void rgLMMGenCntrl
1111 PRIVATE Void rgLMMGenCntrl(cntrl, cfm, cfmPst)
1117 Inst inst = (cfmPst->srcInst - RG_INST_START);
1120 cfm->cfm.status = LCM_PRIM_OK;
1121 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1124 switch(cntrl->t.cntrl.action)
1127 /* Action is Enable */
1128 switch(cntrl->t.cntrl.subAction)
1132 rgCb[inst].rgInit.trc = TRUE;
1133 rgCb[inst].trcLen = cntrl->t.cntrl.s.trcLen;
1134 /*Store the response and TransId for sending the Traces */
1135 cmMemcpy((U8 *)&rgCb[inst].genCfg.trcResp.response,
1136 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1137 rgCb[inst].genCfg.trcResp.transId = cntrl->hdr.transId;
1141 /* Enable Unsolicited Status (alarms) */
1142 rgCb[inst].rgInit.usta = TRUE;
1143 /*Store the response and TransId for sending the Alarms */
1144 cmMemcpy((U8 *)&rgCb[inst].genCfg.ustaResp.response,
1145 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1146 rgCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
1149 /* Enable Debug Printing */
1151 rgCb[inst].rgInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1156 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1161 cfm->cfm.status = LCM_PRIM_NOK;
1162 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1163 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1168 /* Action is Diable immidiately */
1169 switch(cntrl->t.cntrl.subAction)
1172 /* Disable Traces */
1173 rgCb[inst].rgInit.trc = FALSE;
1176 /* Disable Unsolicited Status (alarms) */
1177 rgCb[inst].rgInit.usta = FALSE;
1180 /* Disable Debug Printing */
1182 rgCb[inst].rgInit.dbgMask &=~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1187 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1192 cfm->cfm.status = LCM_PRIM_NOK;
1193 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1194 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1199 /* Free all the memory dynamically allocated by MAC */
1200 rgLMMShutdown(inst);
1203 cfm->cfm.status = LCM_PRIM_NOK;
1204 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1205 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1208 RgMiLrgCntrlCfm(cfmPst, cfm);
1213 /***********************************************************
1215 * Func : rgLMMSapCntrl
1218 * Desc : Processes the LM control request for STxxxSAP elmnt.
1227 **********************************************************/
1229 PRIVATE Void rgLMMSapCntrl
1236 PRIVATE Void rgLMMSapCntrl(cntrl, cfm, cfmPst)
1242 Inst inst = cfmPst->srcInst - RG_INST_START;
1245 /* Only TFU Sap can be controlled by LM */
1246 switch(cntrl->hdr.elmId.elmnt)
1249 switch(cntrl->t.cntrl.action)
1252 /* Bind Enable Request */
1253 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1254 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1256 cfm->cfm.status = LCM_PRIM_NOK;
1257 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
1261 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1263 rgLMMStartTmr(inst,RG_BNDREQ_TMR, rgCb[inst].tfuSap.sapCfg.bndTmr.val,
1264 (PTR)&rgCb[inst].tfuSap);
1266 /* Change SAP state */
1267 rgCb[inst].tfuSap.sapSta.sapState = LRG_WAIT_BNDCFM;
1268 rgCb[inst].tfuSap.numBndRetries++;
1269 /* Store the response and TransId for sending
1270 * the Control confirm */
1271 cmMemcpy((U8 *)&rgCb[inst].genCfg.bndCfmResp.response,
1272 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1273 rgCb[inst].genCfg.bndCfmResp.transId = cntrl->hdr.transId;
1275 /* Sending Status Indication to Layer Manager */
1276 cfm->cfm.status = LCM_PRIM_OK_NDONE;
1277 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1278 RgMiLrgCntrlCfm(cfmPst, cfm);
1280 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1281 rgCb[inst].tfuSap.sapCfg.spId);
1286 /* Unbind request */
1288 /* Check if the SAP is configured */
1289 if( (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1290 (rgCb[inst].tfuSap.sapSta.sapState == LRG_UNBND))
1292 cfm->cfm.status = LCM_PRIM_NOK;
1293 cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
1297 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1298 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1300 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1302 /* Change SAP state */
1303 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1304 cfm->cfm.status = LCM_PRIM_OK;
1305 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1309 /* Delete SAP, does initialization of SAP */
1310 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM) ||
1311 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1313 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1314 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1316 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1319 cmMemset((U8 *)&rgCb[inst].tfuSap, 0, sizeof(RgLowSapCb));
1320 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
1321 cfm->cfm.status = LCM_PRIM_OK;
1322 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1325 cfm->cfm.status = LCM_PRIM_NOK;
1326 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1327 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1328 cntrl->t.cntrl.action));
1333 switch(cntrl->t.cntrl.action)
1336 cmMemset((U8 *)&rgCb[inst].rguSap[cntrl->t.cntrl.instId], 0, sizeof(RgUpSapCb));
1337 rgCb[inst].rguSap[cntrl->t.cntrl.instId].sapSta.sapState = LRG_NOT_CFG;
1338 cfm->cfm.status = LCM_PRIM_OK;
1339 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1342 cfm->cfm.status = LCM_PRIM_NOK;
1343 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1344 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1345 cntrl->t.cntrl.action));
1350 switch(cntrl->t.cntrl.action)
1353 cmMemset((U8 *)&rgCb[inst].crgSap, 0, sizeof(RgUpSapCb));
1354 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
1355 cfm->cfm.status = LCM_PRIM_OK;
1356 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1359 cfm->cfm.status = LCM_PRIM_NOK;
1360 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1361 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1367 /* Would never here. */
1370 RgMiLrgCntrlCfm(cfmPst, cfm);
1375 /***********************************************************
1377 * Func : rgLMMFillCfmPst
1380 * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
1381 * and the cfm->hdr.response.
1390 **********************************************************/
1392 PRIVATE Void rgLMMFillCfmPst
1399 PRIVATE Void rgLMMFillCfmPst(reqPst, cfmPst, cfm)
1406 TRC2(rgLMMFillCfmPst)
1407 inst = (reqPst->dstInst - RG_INST_START);
1409 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
1410 cfmPst->srcInst = rgCb[inst].rgInit.inst;
1411 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
1412 cfmPst->dstEnt = reqPst->srcEnt;
1413 cfmPst->dstInst = reqPst->srcInst;
1414 cfmPst->dstProcId = reqPst->srcProcId;
1416 cfmPst->selector = cfm->hdr.response.selector;
1417 cfmPst->prior = cfm->hdr.response.prior;
1418 cfmPst->route = cfm->hdr.response.route;
1419 cfmPst->region = cfm->hdr.response.mem.region;
1420 cfmPst->pool = cfm->hdr.response.mem.pool;
1427 * @brief Timer start handler.
1431 * Function : rgLMMStartTmr
1433 * This function based on the input parameters starts the timer for
1434 * "tmrVal" duration. As of now MAC uses the timer functionality for
1435 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1437 * @param[in] Inst inst
1438 * @param[in] S16 tmrEvnt, the Timer Event
1439 * @param[in] U32 tmrVal, the Wait Time
1440 * @param[in] PTR cb, Entry for which Timer expired
1445 PUBLIC S16 rgLMMStartTmr
1448 S16 tmrEvnt, /* Timer Event */
1449 U32 tmrVal, /* Wait Time */
1450 PTR cb /* Entry for which Timer Expired */
1453 PUBLIC S16 rgLMMStartTmr(tmrEvnt, tmrVal, cb)
1455 S16 tmrEvnt; /* Timer Event */
1456 U32 tmrVal; /* Wait Time */
1457 PTR cb; /* Entry for which Timer Expired */
1466 /* Initialize the arg structure */
1467 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1469 arg.tqCp = &rgCb[inst].tmrTqCp;
1470 arg.tq = rgCb[inst].tmrTq;
1471 arg.timers = rgCb[inst].tmrBlk;
1474 arg.max = RG_MAX_TIMER;
1475 arg.evnt = RG_BNDREQ_TMR;
1484 * @brief Timer stop handler.
1488 * Function : rgLMMStopTmr
1490 * This function based on the input parameters stops the timer for
1491 * "tmrEvnt". As of now MAC uses the timer functionality for
1492 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1493 * Once the bind happens and this timer is stopped, the timer functionality
1494 * is deregistered with SSI. As there is no further use of timer processing.
1496 * @param[in] Inst inst
1497 * @param[in] S16 tmrEvnt, the Timer Event
1498 * @param[in] PTR cb, Entry for which Timer expired
1504 PUBLIC S16 rgLMMStopTmr
1506 Inst inst, /* Scheduler instance */
1507 S16 tmrEvnt, /* Timer Event */
1508 PTR cb /* Entry for which Timer Expired */
1511 PUBLIC S16 rgLMMStopTmr(inst,tmrEvnt, cb)
1512 Inst inst; /* Scheduler instance */
1513 S16 tmrEvnt; /* Timer Event */
1514 PTR cb; /* Entry for which Timer Expired */
1525 for(i=0;i<RG_MAX_TIMER;i++)
1527 /* Search for the Timer Blocks */
1528 if(rgCb[inst].tmrBlk[i].tmrEvnt == tmrEvnt)
1530 /* Initialize the arg structure */
1531 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1533 arg.tqCp = &rgCb[inst].tmrTqCp;
1534 arg.tq = rgCb[inst].tmrTq;
1535 arg.timers = rgCb[inst].tmrBlk;
1537 arg.max = RG_MAX_TIMER;
1555 * @brief Timer Expiry handler.
1559 * Function : rgLMMTmrExpiry
1561 * This is a callback function used as an input parameter to cmPrcTmr()
1562 * to check expiry of any timer. In this function, the only concern is
1563 * about tmrEvnt=Bind timer.
1565 * @param[in] PTR cb, Entry for which Timer expired
1566 * @param[in] S16 tmrEvnt, the Timer Event
1571 PUBLIC S16 rgLMMTmrExpiry
1573 PTR cb, /* Pointer to timer control block */
1574 S16 tmrEvnt /* Timer Event */
1577 PUBLIC S16 rgLMMTmrExpiry(cb,tmrEvnt)
1578 PTR cb; /* Pointer to timer control block */
1579 S16 tmrEvnt; /* Timer Event */
1583 RgLowSapCb *tfuSap = (RgLowSapCb *)cb;
1584 Inst inst = tfuSap->sapCfg.sapPst.srcInst - RG_INST_START;
1586 TRC2(rgLMMTmrExpiry)
1592 tfuSap->numBndRetries++;
1593 if(tfuSap->numBndRetries > RG_MAX_BNDRETRY)
1595 rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_FAIL,
1596 LCM_CAUSE_TMR_EXPIRED, NULLP);
1600 /* Restart the bind timer */
1601 if (tfuSap->sapCfg.bndTmr.enb == TRUE)
1603 ret = rgLMMStartTmr(inst,RG_BNDREQ_TMR, tfuSap->sapCfg.bndTmr.val,
1607 /* Send bind request */
1608 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1609 rgCb[inst].tfuSap.sapCfg.spId);
1613 RLOG1(L_ERROR, "Invalid tmrEvnt=%d",tmrEvnt);
1623 * @brief Layer Manager Unsolicited Status Indication generation.
1627 * Function : rgLMMStaInd
1629 * This API is used by the other modules of MAC to send a unsolicited
1630 * status indication to the Layer Manager.
1632 * @param[in] Inst inst
1633 * @param[in] U16 category, the Alarm category
1634 * @param[in] U16 event, the Alarm event
1635 * @param[in] U16 cause, the cause of the Alarm
1636 * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
1641 PUBLIC S16 rgLMMStaInd
1650 PUBLIC S16 rgLMMStaInd(inst,category, event, cause, dgn)
1662 if(rgCb[inst].rgInit.usta == FALSE)
1667 cmMemset((U8 *)&usta, 0, sizeof(RgMngmt));
1669 SGetDateTime(&usta.t.usta.cmAlarm.dt);
1670 usta.t.usta.cmAlarm.category = category;
1671 usta.t.usta.cmAlarm.event = event;
1672 usta.t.usta.cmAlarm.cause = cause;
1675 cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn));
1678 rgCb[inst].rgInit.lmPst.selector = rgCb[inst].genCfg.ustaResp.response.selector;
1679 rgCb[inst].rgInit.lmPst.prior = rgCb[inst].genCfg.ustaResp.response.prior;
1680 rgCb[inst].rgInit.lmPst.route = rgCb[inst].genCfg.ustaResp.response.route;
1681 rgCb[inst].rgInit.lmPst.region = rgCb[inst].genCfg.ustaResp.response.mem.region;
1682 rgCb[inst].rgInit.lmPst.pool = rgCb[inst].genCfg.ustaResp.response.mem.pool;
1683 usta.hdr.transId = rgCb[inst].genCfg.ustaResp.transId;
1685 RETVALUE(RgMiLrgStaInd(&rgCb[inst].rgInit.lmPst, &usta));
1690 * @brief Layer Manager Trace Indication generation.
1694 * Function : rgLMMTrcInd
1696 * This API is used by the other modules of MAC to send a
1697 * Trace indication to the Layer Manager.
1699 * @param[in] Inst inst
1700 * @param[in] Buffer *srcMbuf, the Message Buffer .
1701 * @param[in] U8 event, the trace event.
1705 PUBLIC Void rgLMMTrcInd
1708 Buffer *srcMbuf, /* Message Buffer */
1709 U8 event /* event */
1712 PUBLIC Void rgLMMTrcInd(inst,srcMbuf,event)
1714 Buffer *srcMbuf; /* Message Buffer */
1715 U8 event; /* event */
1718 Buffer *dstMbuf = NULLP;
1728 if ((rgCb[inst].trcLen == LRG_NO_TRACE) || (srcMbuf == NULLP))
1730 RLOG0(L_ERROR, "Trace Disabled.");
1734 cmMemset((U8 *)&trc, 0, sizeof(RgMngmt));
1736 pst = rgCb[inst].rgInit.lmPst;
1737 pst.selector = rgCb[inst].genCfg.trcResp.response.selector;
1738 pst.prior = rgCb[inst].genCfg.trcResp.response.prior;
1739 pst.route = rgCb[inst].genCfg.trcResp.response.route;
1740 pst.region = rgCb[inst].genCfg.trcResp.response.mem.region;
1741 pst.pool = rgCb[inst].genCfg.trcResp.response.mem.pool;
1743 trc.hdr.transId = rgCb[inst].genCfg.trcResp.transId;
1745 SGetDateTime(&trc.t.trc.dt);
1747 /* Check if the whole buffer is to be sent in Trace indication */
1748 if(rgCb[inst].trcLen == LRG_FULL_TRACE)
1750 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1753 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1756 trc.cfm.status = LCM_PRIM_OK;
1757 trc.cfm.reason = LCM_REASON_NOT_APPL;
1758 trc.t.trc.evnt = event;
1760 /* Send Trace Indication to Layer manager */
1761 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1763 /* check if only a specified number of bytes are to be sent */
1764 else if(rgCb[inst].trcLen > 0)
1766 /* Get the length of the recvd message buffer */
1767 if (SFndLenMsg(srcMbuf, &bufLen) != ROK)
1769 RLOG0(L_ERROR, "SFndLenMsg Failed.");
1772 /* Check if the recvd buffer size is less than request trace len */
1773 if(bufLen < rgCb[inst].trcLen)
1775 /* Copy the whole of the recvd buffer in trace indication */
1777 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1780 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1784 trc.cfm.status = LCM_PRIM_OK;
1785 trc.cfm.reason = LCM_REASON_NOT_APPL;
1786 trc.t.trc.evnt = event;
1788 /* Send Trace Indication to Layer manager */
1789 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1791 /* if the recvd buffer size is greater than request trace len */
1792 if(bufLen >= rgCb[inst].trcLen)
1794 /* Get a temporary buffer to store the msg */
1795 if (rgAllocSBuf(inst,&tempBuf, rgCb[inst].trcLen) != ROK)
1797 RLOG0(L_ERROR, "rgAllocSBuf Failed.");
1801 /* Copy trcLen nos of bytes from the recvd message */
1802 if (SCpyMsgFix(srcMbuf,0,rgCb[inst].trcLen,tempBuf,&tempCnt) != ROK)
1804 RLOG0(L_ERROR, "SCpyMsgFix Failed.");
1808 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
1810 RLOG0(L_ERROR, "dstMbuf Allocation Failed");
1813 /* Copy the tempBuf data to dst mBuf */
1814 if (SCpyFixMsg(tempBuf,dstMbuf,0,rgCb[inst].trcLen,&tempCnt) != ROK)
1816 RLOG0(L_ERROR, "SCpyFixMsg Failed.");
1820 /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
1822 /* Free the memory allocated for tempBuf */
1823 rgFreeSBuf(inst,&tempBuf, rgCb[inst].trcLen);
1825 trc.cfm.status = LCM_PRIM_OK;
1826 trc.cfm.reason = LCM_REASON_NOT_APPL;
1827 trc.t.trc.evnt = event;
1829 /* Send Trace Indication to Layer manager */
1830 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1838 * @brief Layer Manager Control Confirm generation handler
1839 * for Bind Confirm reception at TFU interface.
1840 * RgLiTfuBndCfm() forwards the confirmation to this
1841 * function. All SAP state related handling is restricted
1842 * to LMM modules, hence the cfm forwarding.
1846 * Function : rgLMMBndCfm
1848 * This API is used by the LIM module of MAC to forward
1849 * the Bind Confirm it receives over the TFU interface.
1851 * @param[in] Pst *pst, Post Structure
1852 * @param[in] SuId suId, Service user ID
1853 * @param[in] U8 status, Status
1858 PUBLIC S16 rgLMMBndCfm
1860 Pst *pst, /* Post Structure */
1861 SuId suId, /* Service user ID */
1862 U8 status /* Status */
1865 PUBLIC S16 rgLMMBndCfm(pst,suId,status)
1866 Pst *pst; /* Post Structure */
1867 SuId suId; /* Service user ID */
1868 U8 status; /* Status */
1871 Inst inst = pst->dstInst - RG_INST_START;
1880 /* Check if the suId is valid */
1881 if(rgCb[inst].tfuSap.sapCfg.suId != suId)
1883 RLOG0(L_ERROR, "Invalid SuId");
1887 /* check the Sap State */
1888 switch(rgCb[inst].tfuSap.sapSta.sapState)
1890 case LRG_WAIT_BNDCFM:
1893 /* SAP is already bound */
1899 cfmPst = rgCb[inst].rgInit.lmPst;
1900 cfmPst.selector = rgCb[inst].genCfg.bndCfmResp.response.selector;
1901 cfmPst.prior = rgCb[inst].genCfg.bndCfmResp.response.prior;
1902 cfmPst.route = rgCb[inst].genCfg.bndCfmResp.response.route;
1903 cfmPst.region = rgCb[inst].genCfg.bndCfmResp.response.mem.region;
1904 cfmPst.pool = rgCb[inst].genCfg.bndCfmResp.response.mem.pool;
1906 cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
1910 case CM_BND_OK: /* status is OK */
1911 /* Change SAP state to Bound */
1912 rgCb[inst].tfuSap.sapSta.sapState = LRG_BND;
1913 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1915 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1917 /* Send Control Confirm with status as OK to Layer Manager */
1918 cntrlCfm.cfm.status = LCM_PRIM_OK;
1919 cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
1923 /* Change SAP state to UnBound */
1924 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1925 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1927 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1929 /* Send Control Confirm with status as NOK to Layer Manager */
1930 cntrlCfm.cfm.status = LCM_PRIM_NOK;
1931 cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1934 rgCb[inst].tfuSap.numBndRetries = 0;
1935 cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1936 cntrlCfm.hdr.transId = rgCb[inst].genCfg.bndCfmResp.transId;
1938 ret = RgMiLrgCntrlCfm(&cfmPst, &cntrlCfm);
1945 * @brief LTE MAC timer call back function registered with SSI.
1949 * Function : rgActvTmr
1951 * This function is invoked by SSI for every timer activation
1958 PUBLIC S16 rgActvTmr
1964 PUBLIC S16 rgActvTmr(ent, inst)
1969 Inst macInst = (inst - RG_INST_START);
1972 /* Check if any MAC timer has expired */
1973 cmPrcTmr(&rgCb[macInst].tmrTqCp, rgCb[macInst].tmrTq, (PFV) rgLMMTmrExpiry);
1977 } /* end of rgActvTmr */
1980 * @brief Layer Manager Configuration request handler for Scheduler
1984 * Function : MacSchGenCfgReq
1986 * This function receives general configurations for Scheduler
1987 * from DU APP and forwards to Scheduler.
1989 * @param[in] Pst *pst, the post structure
1990 * @param[in] RgMngmt *cfg, the configuration parameter's structure
1995 PUBLIC int MacSchGenCfgReq
1997 Pst *pst, /* post structure */
1998 RgMngmt *cfg /* config structure */
2001 PUBLIC int MacSchGenCfgReq(pst, cfg)
2002 Pst *pst; /* post structure */
2003 RgMngmt *cfg; /* config structure */
2006 printf("\nReceived Scheduler gen config at MAC");
2007 pst->dstInst = DEFAULT_CELLS + 1;
2008 HandleSchGenCfgReq(pst, cfg);
2014 * @brief Layer Manager Configuration response from Scheduler
2018 * Function : SchSendCfgCfm
2020 * This function sends general configurations response from
2021 * Scheduler to DU APP.
2023 * @param[in] Pst *pst, the post structure
2024 * @param[in] RgMngmt *cfm, the configuration confirm structure
2029 PUBLIC S16 SchSendCfgCfm
2031 Pst *pst, /* post structure */
2032 RgMngmt *cfm /* config confirm structure */
2035 PUBLIC S16 SchSendCfgCfm(pst, cfm)
2036 Pst *pst; /* post structure */
2037 RgMngmt *cfm; /* config confirm structure */
2040 printf("\nSending Scheduler config confirm to DU APP");
2041 pst->dstEnt = ENTDUAPP;
2044 pst->selector = MAC_SCH_LC_SELECTOR;
2045 RgMiLrgSchCfgCfm(pst, cfm);
2051 /***********************************************************
2053 * Func : macCellCfgFillCfmPst
2056 * Desc : Fills the Confirmation Post Structure cfmPst
2064 **********************************************************/
2065 Void macCellCfgFillCfmPst
2072 inst = reqPst->dstInst;
2074 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
2075 cfmPst->srcInst = rgCb[inst].rgInit.inst;
2076 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
2078 cfmPst->dstEnt = ENTDUAPP;
2079 cfmPst->dstInst = 0;
2080 cfmPst->dstProcId = cfmPst->srcProcId;
2082 cfmPst->selector = LRG_SEL_LC;
2083 cfmPst->prior = reqPst->prior;
2084 cfmPst->route = reqPst->route;
2085 cfmPst->region = reqPst->region;
2086 cfmPst->pool = reqPst->pool;
2087 cfmPst->event = EVENT_MAC_CELL_CONFIG_CFM;
2093 * @brief Layer Manager Configuration request handler.
2097 * Function : MacHdlCellCfgReq
2099 * This function handles the gNB and cell configuration
2100 * request received from DU APP.
2101 * This API unapcks and forwards the config towards SCH
2103 * @param[in] Pst *pst
2104 * @param[in] MacCellCfg *macCellCfg
2108 int MacHdlCellCfgReq
2111 MacCellCfg *macCellCfg
2117 MacCellCb *macCellCb;
2118 Inst inst = pst->dstInst;
2120 cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
2121 MAC_ALLOC(cellCb,sizeof(RgCellCb));
2125 DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n");
2129 memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
2130 rgCb[inst].cell = cellCb;
2132 MAC_ALLOC(macCellCb,sizeof(MacCellCb));
2133 if(macCellCb == NULLP)
2135 DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
2138 macCb.macCell = macCellCb;
2139 macCb.macCell->cellId = macCellCfg->cellId;
2140 /* Send cell cfg to scheduler */
2141 ret = MacSchCellCfgReq(pst, macCellCfg);
2144 MacCellCfgCfm macCellCfgCfm;
2145 macCellCfgCfm.rsp = RSP_NOK;
2146 macCellCfgCfm.transId = macCellCfg->transId;
2147 macCellCfgFillCfmPst(pst,&cfmPst);
2148 ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
2151 LwrMacEnqueueWlsBlock();
2154 } /* end of MacHdlCellCfgReq */
2157 * @brief Layer Manager Configuration request handler.
2161 * Function : MacSchCellCfgReq
2163 * This function sends cell configuration to SCH
2165 * @param[in] Pst *pst
2166 * @param[in] MacCellCfg *macCellCfg
2170 int MacSchCellCfgReq
2173 MacCellCfg *macCellCfg
2176 SchCellCfg schCellCfg;
2180 cmMemset((U8 *)&cfgPst, 0, sizeof(Pst));
2181 schCellCfg.cellId = macCellCfg->cellId;
2182 schCellCfg.phyCellId = macCellCfg->phyCellId;
2183 schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
2184 schCellCfg.dupMode = macCellCfg->dupType;
2186 /* fill ssb scheduler parameters */
2187 schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
2188 schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
2189 schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
2190 schCellCfg.ssbSchCfg.ssbPeriod = macCellCfg->ssbCfg.ssbPeriod;
2191 schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
2192 for(uint8_t idx=0; idx<SSB_MASK_SIZE; idx++)
2194 schCellCfg.ssbSchCfg.nSSBMask[idx] = macCellCfg->ssbCfg.ssbMask[idx];
2197 /* fill SIB1 scheduler parameters */
2198 schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen;
2199 schCellCfg.sib1SchCfg.sib1NewTxPeriod = macCellCfg->sib1Cfg.sib1NewTxPeriod;
2200 schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod;
2201 schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex;
2202 schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex;
2203 schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs;
2205 /* fill RACH config params */
2206 schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
2207 schCellCfg.schRachCfg.prachSubcSpacing = \
2208 macCellCfg->prachCfg.prachSubcSpacing;
2209 schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
2210 schCellCfg.schRachCfg.msg1Fdm = macCellCfg->prachCfg.msg1Fdm;
2211 schCellCfg.schRachCfg.rootSeqLen = macCellCfg->prachCfg.rootSeqLen;
2212 schCellCfg.schRachCfg.rootSeqIdx = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
2213 schCellCfg.schRachCfg.numRootSeq = macCellCfg->prachCfg.fdm[0].numRootSeq;
2214 schCellCfg.schRachCfg.k1 = macCellCfg->prachCfg.fdm[0].k1;
2215 schCellCfg.schRachCfg.ssbPerRach = macCellCfg->prachCfg.ssbPerRach;
2216 schCellCfg.schRachCfg.prachMultCarrBand = \
2217 macCellCfg->prachCfg.prachMultCarrBand;
2218 schCellCfg.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr;
2219 schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
2220 schCellCfg.schRachCfg.raRspWindow = macCellCfg->prachCfg.raRspWindow;
2222 /* fill initial DL BWP */
2223 schCellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
2224 schCellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
2225 schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
2226 schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
2227 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
2228 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
2229 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
2230 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
2231 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
2232 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
2233 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
2234 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
2235 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
2236 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
2237 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
2238 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
2239 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
2240 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
2241 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
2242 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
2243 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
2244 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
2245 schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
2246 macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
2247 schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
2248 schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
2249 macCellCfg->initialDlBwp.pdschCommon.mappingType;
2250 schCellCfg.schInitialDlBwp.pdschCommon.startSymbol =
2251 macCellCfg->initialDlBwp.pdschCommon.startSymbol;
2252 schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol =
2253 macCellCfg->initialDlBwp.pdschCommon.lengthSymbol;
2255 /* fill initial UL BWP */
2256 schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
2257 schCellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
2258 schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
2259 schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
2260 schCellCfg.schInitialUlBwp.puschCommon.k2 = macCellCfg->initialUlBwp.puschCommon.k2;
2261 schCellCfg.schInitialUlBwp.puschCommon.mappingType =
2262 macCellCfg->initialUlBwp.puschCommon.mappingType;
2263 schCellCfg.schInitialUlBwp.puschCommon.startSymbol =
2264 macCellCfg->initialUlBwp.puschCommon.startSymbol;
2265 schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol =
2266 macCellCfg->initialUlBwp.puschCommon.lengthSymbol;
2269 cfgPst.srcProcId = pst->dstProcId;
2270 cfgPst.dstProcId = pst->srcProcId;
2271 cfgPst.srcEnt = ENTRG;
2273 cfgPst.dstEnt = ENTRG;
2275 cfgPst.selector = MAC_SCH_TC_SELECTOR;
2276 cfgPst.event = EVENT_SCH_CELL_CFG;
2278 ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg);
2280 } /* end of MacSchCellCfgReq */
2283 /*******************************************************************
2285 * @brief Sends Cell config confirm to DU APP
2289 * Function : MacSendCellCfgCfm
2292 * Sends Cell config confirm to DU APP
2294 * @params[in] Response status
2297 * ****************************************************************/
2298 void MacSendCellCfgCfm(uint8_t response)
2302 MacCellCfgCfm macCellCfgCfm;
2304 cmMemset((U8 *)&pst, 0, sizeof(Pst));
2305 cellCb = rgCb[macCb.macInst].cell;
2307 macCellCfgCfm.transId = cellCb->macCellCfg.transId;
2308 macCellCfgCfm.rsp = response;
2310 memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
2311 pst.event = EVENT_MAC_CELL_CONFIG_CFM;
2312 (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
2317 * @brief Layer Manager Configuration response handler.
2321 * Function : MacProcSchCellCfgCfm
2323 * This function processes cell configuration to SCH
2325 * @param[in] Pst *pst
2326 * @param[in] SchCellCfgCfm *schCellCfgCfm
2330 int MacProcSchCellCfgCfm
2333 SchCellCfgCfm *schCellCfgCfm
2336 if(schCellCfgCfm->rsp == RSP_OK)
2338 sendToLowerMac(CONFIG_REQUEST, 0, (void *)NULL);
2342 MacSendCellCfgCfm(RSP_NOK);
2347 /**********************************************************************
2350 **********************************************************************/