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 "envopt.h" /* environment options */
42 #include "envdep.h" /* environment dependent */
43 #include "envind.h" /* environment independent */
44 #include "gen.h" /* general */
45 #include "ssi.h" /* system services */
46 #include "cm_tkns.h" /* Common Token Defines */
47 #include "cm_llist.h" /* Common Link List Defines */
48 #include "cm_hash.h" /* Common Hash List Defines */
49 #include "cm_mblk.h" /* common memory link list library */
50 #include "cm_lte.h" /* Common LTE Defines */
51 #include "rg_env.h" /* MAC Environment Defines */
52 #include "crg.h" /* CRG Interface defines */
53 #include "rgu.h" /* RGU Interface defines */
54 #include "tfu.h" /* RGU Interface defines */
55 #include "rg_sch_inf.h" /* RGR Interface defines */
56 #include "lrg.h" /* LRG Interface defines */
57 #include "rgr.h" /* LRG Interface defines */
58 #include "rg.h" /* MAC defines */
59 #include "rg_err.h" /* MAC error defines */
62 /* header/extern include files (.x) */
63 #include "gen.x" /* general */
64 #include "ssi.x" /* system services */
65 #include "cm5.x" /* system services */
66 #include "cm_tkns.x" /* Common Token Definitions */
67 #include "cm_llist.x" /* Common Link List Definitions */
68 #include "cm_lib.x" /* Common Library Definitions */
69 #include "cm_hash.x" /* Common Hash List Definitions */
70 #include "cm_mblk.x" /* common memory link list library */
71 #include "cm_lte.x" /* Common LTE Defines */
72 #include "crg.x" /* CRG Interface includes */
73 #include "rgu.x" /* RGU Interface includes */
74 #include "tfu.x" /* RGU Interface includes */
75 #include "rg_sch_inf.x" /* SCH Interface includes */
76 #include "rg_prg.x" /* PRG Interface includes */
77 #include "lrg.x" /* LRG Interface includes */
78 #include "rgr.x" /* LRG Interface includes */
79 #include "du_app_mac_inf.h"
80 #include "rg.x" /* MAC includes */
82 #include "ss_diag.h" /* Common log file */
86 #include "lwr_mac.h" /* MAC CL defines */
88 #include "lwr_mac_phy.h"
89 #include "lwr_mac_fsm.h"
93 #endif /* __cplusplus */
94 EXTERN Void rgGetSId ARGS((SystemId *s));
97 #endif /* __cplusplus */
99 /* Public variable declaration */
103 int MacSchCellCfgReq(Pst *pst,MacCellCfg *macCellCfg);
105 /* forward references */
106 PRIVATE U16 rgLMMGenCfg ARGS((
111 PRIVATE U16 rgLMMSapCfg ARGS((
117 PRIVATE Void rgLMMShutdown ARGS((
121 PRIVATE Void rgLMMFillCfmPst ARGS((
127 PRIVATE Void rgLMMGenCntrl ARGS((
133 PRIVATE Void rgLMMSapCntrl ARGS((
139 extern int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
141 packMacCellCfgConfirm packMacCellCfmOpts[] =
143 packMacCellCfgCfm, /* packing for loosely coupled */
144 duHandleMacCellCfgCfm, /* packing for tightly coupled */
145 packMacCellCfgCfm, /* packing for light weight loosly coupled */
148 SchCellCfgFunc SchCellCfgOpts[] =
150 packSchCellCfg, /* packing for loosely coupled */
151 SchHdlCellCfgReq, /* packing for tightly coupled */
152 packSchCellCfg /* packing for light weight loosly coupled */
157 * @brief Task Initiation callback function.
161 * Function : rgActvInit
163 * This function is supplied as one of parameters during MAC's
164 * task registration. SSI will invoke this function once, after
165 * it creates and attaches this TAPA Task to a system task.
167 * @param[in] Ent entity, the entity ID of this task.
168 * @param[in] Inst inst, the instance ID of this task.
169 * @param[in] Region region, the region ID registered for memory
170 * usage of this task.
171 * @param[in] Reason reason.
176 PUBLIC S16 rgActvInit
178 Ent entity, /* entity */
179 Inst inst, /* instance */
180 Region region, /* region */
181 Reason reason /* reason */
184 PUBLIC S16 rgActvInit(entity, inst, region, reason)
185 Ent entity; /* entity */
186 Inst inst; /* instance */
187 Region region; /* region */
188 Reason reason; /* reason */
194 RG_IS_INST_VALID(inst);
196 macInst = inst - RG_INST_START;
197 /* Initialize the MAC TskInit structure to zero */
198 cmMemset ((U8 *)&rgCb[macInst], 0, sizeof(RgCb));
200 /* Initialize the MAC TskInit with received values */
201 rgCb[macInst].rgInit.ent = entity;
202 rgCb[macInst].rgInit.inst = inst;
203 rgCb[macInst].rgInit.region = region;
204 rgCb[macInst].rgInit.pool = 0;
205 rgCb[macInst].rgInit.reason = reason;
206 rgCb[macInst].rgInit.cfgDone = FALSE;
207 rgCb[macInst].rgInit.acnt = FALSE;
208 rgCb[macInst].rgInit.usta = FALSE;
209 rgCb[macInst].rgInit.trc = FALSE;
210 rgCb[macInst].trcLen = 0;
213 /* disabling debugs by default */
214 rgCb[macInst].rgInit.dbgMask = 0xffffffff;
218 rgCb[macInst].rgInit.logMask = 0x0;
220 rgCb[macInst].rgInit.procId = SFndProcId();
221 rgCb[macInst].tfuSap.numBndRetries = 0;
223 /* Initialize Sap state */
224 rgCb[macInst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
225 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
226 rgCb[macInst].rguSap = NULLP;
227 rgCb[macInst].crgSap.sapSta.sapState = LRG_NOT_CFG;
229 rgCb[macInst].inactiveCell = NULLP;
230 rgCb[macInst].cell = NULLP;
232 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULMAC,SS_RNG_TX);
233 SAttachSRngBuf(SS_RNG_BUF_ULMAC_TO_ULRLC, SS_RBUF_ENT_ULRLC,SS_RNG_RX);
236 /* Initializing CL control block */
237 clGlobalCp.region = region;
239 clGlobalCp.clCfgDone = FALSE;
240 clGlobalCp.numOfCells = 0;
241 clGlobalCp.phyState = PHY_STATE_IDLE;
243 if( cmHashListInit(&clGlobalCp.cellCbLst, MAX_NUM_CELL_SUPP, 0x0, FALSE,
244 CM_HASH_KEYTYPE_DEF, clGlobalCp.region, clGlobalCp.pool ) != ROK )
246 printf("\n Cellcb hash list initialization failed for MAC CL");
250 /* Initialize Scheduler as well */
251 schActvInit(ENTRG, (DEFAULT_CELLS + SCH_INST_START), DFLT_REGION, PWR_UP);
253 /* Initialize lower mac */
261 * @brief Layer Manager Configuration request handler.
265 * Function : RgMiLrgCfgReq
267 * This function handles the configuration
268 * request received from the Layer Manager.
269 * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the
270 * functions rgHdlGenCfg() or rgHdlSapCfg().
271 * -# Invokes RgMiLrgCfgCfm() to send back the confirmation to the LM.
273 * @param[in] Pst *pst, the post structure
274 * @param[in] RgMngmt *cfg, the configuration parameter's structure
279 PUBLIC S16 RgMiLrgCfgReq
281 Pst *pst, /* post structure */
282 RgMngmt *cfg /* config structure */
285 PUBLIC S16 RgMiLrgCfgReq(pst, cfg)
286 Pst *pst; /* post structure */
287 RgMngmt *cfg; /* config structure */
290 U16 ret = LCM_PRIM_OK;
291 U16 reason = LCM_REASON_NOT_APPL;
299 RG_DIAG_LVL0(inst,0x0a0b0001, RG_DIAG_NA, SS_DIAG_INV_ARG,
300 "Received CfgReq for MAC layer, Entity = %d, Instance = %d\n",
301 pst->srcEnt, pst->srcInst,0,0);
303 RG_IS_INST_VALID(pst->dstInst);
304 inst = pst->dstInst - RG_INST_START;
306 /* Fill the post structure for sending the confirmation */
307 rgLMMFillCfmPst(pst, &cfmPst, cfg);
309 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
312 cfm.hdr.transId = cfg->hdr.transId;
316 cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt;
317 switch(cfg->hdr.elmId.elmnt)
320 reason = rgLMMGenCfg(inst,&cfg->t.cfg);
325 reason = rgLMMSapCfg(inst,&cfg->t.cfg, cfg->hdr.elmId.elmnt);
329 reason = LCM_REASON_INVALID_ELMNT;
330 RLOG1(L_ERROR, "Invalid Elmnt=%d",
331 cfg->hdr.elmId.elmnt);
335 if (reason != LCM_REASON_NOT_APPL)
340 cfm.cfm.status = ret;
341 cfm.cfm.reason = reason;
343 RgMiLrgCfgCfm(&cfmPst, &cfm);
346 }/*-- RgMiLrgCfgReq --*/
350 * @brief Layer Manager Statistics request handler.
354 * Function : RgMiLrgStsReq
356 * This function handles the statistics
357 * request received from the Layer Manager.
358 * -# Based on sts->hdr.elmId.elmnt, it retrieves either general or SAP
359 * statistics from the rgCb global control block.
360 * -# If action=ARST, it will reset the statistics parameters in rgCb to 0.
361 * -# Invokes the RgMiLrgStsCfm to send back the confirmation to LM.
363 * @param[in] Pst *pst, the post structure
364 * @param[in] RgMngmt *sts, the statistics parameter's structure
369 PUBLIC S16 RgMiLrgStsReq
371 Pst *pst, /* post structure */
372 RgMngmt *sts /* statistics structure */
375 PUBLIC S16 RgMiLrgStsReq(pst, sts)
376 Pst *pst; /* post structure */
377 RgMngmt *sts; /* statistics structure */
387 RG_IS_INST_VALID(pst->dstInst);
388 inst = pst->dstInst - RG_INST_START;
389 /* Fill the post structure for sending the confirmation */
390 rgLMMFillCfmPst(pst, &cfmPst, sts);
392 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
395 cfm.hdr.transId = sts->hdr.transId;
397 SGetDateTime(&cfm.t.sts.dt);
398 cfm.cfm.status = LCM_PRIM_OK;
399 cfm.cfm.reason = LCM_REASON_NOT_APPL;
400 cfm.hdr.elmId.elmnt = sts->hdr.elmId.elmnt;
401 cfm.t.sts.action = sts->t.sts.action;
403 /* Check if General Config Done */
404 if(rgCb[inst].rgInit.cfgDone != TRUE)
406 cfm.cfm.status = LCM_PRIM_NOK;
407 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
408 RgMiLrgStsCfm(&cfmPst,&cfm);
409 RLOG0(L_ERROR, "Gen Cfg not done");
413 switch(sts->hdr.elmId.elmnt)
417 cmMemcpy((U8 *)&(cfm.t.sts.s.genSts), (U8 *)&rgCb[inst].genSts,
419 /* check if action is read and reset */
420 if(sts->t.sts.action == ARST)
422 rgCb[inst].genSts.numHarqFail = 0;
427 RgGenSts *genSts = &(cfm.t.sts.s.genSts);
429 for(cqi=0; cqi <= 14; cqi++)
431 /* Filling DL ACK/NACK stats */
432 genSts->nackAckStats.dlCqiStat[cqi].mcs = \
433 hqFailStats.dlCqiStat[cqi].mcs;
434 genSts->nackAckStats.dlCqiStat[cqi].numOfNacks = \
435 hqFailStats.dlCqiStat[cqi].numOfNacks;
436 genSts->nackAckStats.dlCqiStat[cqi].numOfAcks =
437 hqFailStats.dlCqiStat[cqi].numOfAcks;
439 /* Filling UL ACK/NACK stats */
440 genSts->nackAckStats.ulCqiStat[cqi].mcs = \
441 hqFailStats.ulCqiStat[cqi].mcs;
442 genSts->nackAckStats.ulCqiStat[cqi].numOfNacks = \
443 hqFailStats.ulCqiStat[cqi].numOfNacks;
444 genSts->nackAckStats.ulCqiStat[cqi].numOfAcks = \
445 hqFailStats.ulCqiStat[cqi].numOfAcks;
447 /* Filling DL HQ Retx stats */
448 genSts->hqRetxStats.dlCqiStat[cqi].mcs = \
449 hqRetxStats.dlCqiStat[cqi].mcs;
450 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_1 = \
451 hqRetxStats.dlCqiStat[cqi].numOfHQ_1;
452 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_2 = \
453 hqRetxStats.dlCqiStat[cqi].numOfHQ_2;
454 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_3 = \
455 hqRetxStats.dlCqiStat[cqi].numOfHQ_3;
456 genSts->hqRetxStats.dlCqiStat[cqi].numOfHQ_4 = \
457 hqRetxStats.dlCqiStat[cqi].numOfHQ_4;
458 genSts->hqRetxStats.dlCqiStat[cqi].totalTx = \
459 hqRetxStats.dlCqiStat[cqi].totalTx;
461 /* Filling UL HQ Retx stats */
462 genSts->hqRetxStats.ulCqiStat[cqi].mcs = \
463 hqRetxStats.ulCqiStat[cqi].mcs;
464 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_1 = \
465 hqRetxStats.ulCqiStat[cqi].numOfHQ_1;
466 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_2 = \
467 hqRetxStats.ulCqiStat[cqi].numOfHQ_2;
468 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_3 = \
469 hqRetxStats.ulCqiStat[cqi].numOfHQ_3;
470 genSts->hqRetxStats.ulCqiStat[cqi].numOfHQ_4 = \
471 hqRetxStats.ulCqiStat[cqi].numOfHQ_4;
472 genSts->hqRetxStats.ulCqiStat[cqi].totalTx = \
473 hqRetxStats.ulCqiStat[cqi].totalTx;
475 /* Reset statistics */
476 if(sts->t.sts.action == ZEROSTS)
478 cmMemset((U8 *)&hqRetxStats, 0, \
479 sizeof(RgSchHqRetxStats));
480 cmMemset((U8 *)&hqFailStats, 0, \
481 sizeof(RgSchNackAckStats));
484 #endif /* MAC_SCH_STATS*/
488 cmMemcpy((U8 *)&(cfm.t.sts.s.rguSts), (U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts,
491 /* check if action is read and reset */
492 if(sts->t.sts.action == ARST)
493 cmMemset((U8 *)&rgCb[inst].rguSap[sts->t.sts.sapInst].sapSts, 0, sizeof(RgSapSts));
497 cmMemcpy((U8 *)&(cfm.t.sts.s.crgSts), (U8 *)&rgCb[inst].crgSap.sapSts,
500 /* check if action is read and reset */
501 if(sts->t.sts.action == ARST)
502 cmMemset((U8 *)&rgCb[inst].crgSap.sapSts, 0, sizeof(RgSapSts));
506 cmMemcpy((U8 *)&(cfm.t.sts.s.tfuSts), (U8 *)&rgCb[inst].tfuSap.sapSts,
509 /* check if action is read and reset */
510 if(sts->t.sts.action == ARST)
511 cmMemset((U8 *)&rgCb[inst].tfuSap.sapSts, 0, sizeof(RgSapSts));
515 cfm.cfm.status = LCM_PRIM_NOK;
516 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
517 RLOG1(L_ERROR, "Invalid Elmnt = %d",sts->hdr.elmId.elmnt);
520 RgMiLrgStsCfm(&cfmPst,&cfm);
522 }/*-- RgMiLrgStsReq --*/
526 * @brief Layer Manager Status request handler.
530 * Function : RgMiLrgStaReq
532 * This function handles the solicited status
533 * request received from the Layer Manager.
534 * -# Based on sta->hdr.elmId.elmnt, it retrieves the status of a
535 * particular SAP from the rgCb global control block.
536 * -# Invokes the RgMiLrgStaCfm to send back the confirmation to LM.
538 * @param[in] Pst *pst, the post structure
539 * @param[in] RgMngmt *sta, the status parameter's structure
544 PUBLIC S16 RgMiLrgStaReq
546 Pst *pst, /* post structure */
547 RgMngmt *sta /* status structure */
550 PUBLIC S16 RgMiLrgStaReq(pst, sta)
551 Pst *pst; /* post structure */
552 RgMngmt *sta; /* status structure */
562 RG_IS_INST_VALID(pst->dstInst);
563 inst = pst->dstInst - RG_INST_START;
566 /* Fill the post structure for sending the confirmation */
567 rgLMMFillCfmPst(pst, &cfmPst, sta);
569 if (sta->t.ssta.s.sysId.ptNmb != NULLP)
571 SPutSBuf(pst->region, pst->pool, (Data *)sta->t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
574 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
575 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
578 cfm.hdr.transId = sta->hdr.transId;
580 /* Check if General Config Done */
581 if(rgCb[inst].rgInit.cfgDone != TRUE)
583 SGetDateTime(&cfm.t.ssta.dt);
584 if (SGetSBuf(cfmPst.region, cfmPst.pool,
585 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
588 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
591 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
592 rgGetSId(&cfm.t.ssta.s.sysId);
593 cfm.cfm.status = LCM_PRIM_NOK;
594 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
595 cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
596 RgMiLrgStaCfm(&cfmPst, &cfm);
597 RLOG0(L_ERROR, "Gen Cfg not done");
601 switch(sta->hdr.elmId.elmnt)
604 SGetDateTime(&cfm.t.ssta.dt);
605 if (SGetSBuf(cfmPst.region, cfmPst.pool,
606 (Data **)&(cfm.t.ssta.s.sysId.ptNmb), LRG_MAX_PT_NUM_SIZE)
609 RLOG0(L_ERROR, "Memory Unavailable for Confirmation");
612 cmMemset((U8 *)(cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
613 rgGetSId(&cfm.t.ssta.s.sysId);
614 cfm.cfm.status = LCM_PRIM_OK;
615 cfm.cfm.reason = LCM_REASON_NOT_APPL;
616 RgMiLrgStaCfm(&cfmPst, &cfm);
619 cfm.cfm.status = LCM_PRIM_OK;
620 cfm.cfm.reason = LCM_REASON_NOT_APPL;
621 SGetDateTime(&cfm.t.ssta.dt);
622 cmMemcpy((U8 *)&(cfm.t.ssta.s.rguSapSta),
623 (U8 *)&rgCb[inst].rguSap[sta->t.ssta.sapInst].sapSta,
625 RgMiLrgStaCfm(&cfmPst, &cfm);
628 cfm.cfm.status = LCM_PRIM_OK;
629 cfm.cfm.reason = LCM_REASON_NOT_APPL;
630 SGetDateTime(&cfm.t.ssta.dt);
631 cmMemcpy((U8 *)&(cfm.t.ssta.s.crgSapSta), (U8 *)&rgCb[inst].crgSap.sapSta,
633 RgMiLrgStaCfm(&cfmPst, &cfm);
636 cfm.cfm.status = LCM_PRIM_OK;
637 cfm.cfm.reason = LCM_REASON_NOT_APPL;
638 SGetDateTime(&cfm.t.ssta.dt);
639 cmMemcpy((U8 *)&(cfm.t.ssta.s.tfuSapSta), (U8 *)&rgCb[inst].tfuSap.sapSta,
641 RgMiLrgStaCfm(&cfmPst, &cfm);
644 cfm.cfm.status = LCM_PRIM_NOK;
645 cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
646 RgMiLrgStaCfm(&cfmPst, &cfm);
647 RLOG1(L_ERROR, "Invalid elmnt=%d",sta->hdr.elmId.elmnt);
651 }/*-- RgMiLrgStaReq --*/
655 * @brief Layer Manager Control request handler.
659 * Function : RgMiLrgCntrlReq
661 * This function handles the control
662 * request received from the Layer Manager.
663 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
664 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
665 * of SAP (enable/disable), Debug (enable/disable), Trace (enable/disable)
666 * and layer shutdown.
667 * -# Invokes the RgMiLrgCntrlCfm to send back the confirmation to LM.
669 * @param[in] Pst *pst, the post structure
670 * @param[in] RgMngmt *cntrl, the control parameter's structure
675 PUBLIC S16 RgMiLrgCntrlReq
677 Pst *pst, /* post structure */
678 RgMngmt *cntrl /* control structure */
681 PUBLIC S16 RgMiLrgCntrlReq(pst, cntrl)
682 Pst *pst; /* post structure */
683 RgMngmt *cntrl; /* control structure */
686 S16 ret = ROK; /* return value */
691 TRC2(RgMiLrgCntrlReq)
693 /* Fill the post structure for sending the confirmation */
695 RG_IS_INST_VALID(pst->dstInst);
696 inst = pst->dstInst - RG_INST_START;
698 rgLMMFillCfmPst(pst, &cfmPst, cntrl);
700 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
702 cfm.hdr.transId = cntrl->hdr.transId;
704 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
705 cfm.t.cntrl.action = cntrl->t.cntrl.action;
706 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
708 /* Check if General Config Done*/
709 if(rgCb[inst].rgInit.cfgDone != TRUE)
711 cfm.cfm.status = LCM_PRIM_NOK;
712 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
713 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
714 RgMiLrgCntrlCfm(&cfmPst, &cfm);
715 RLOG0(L_ERROR, "Gen Cfg not done");
719 /* General Config done, process the Control request */
720 switch(cntrl->hdr.elmId.elmnt)
723 rgLMMGenCntrl(cntrl, &cfm, &cfmPst);
728 rgLMMSapCntrl(cntrl, &cfm, &cfmPst);
731 cfm.cfm.status = LCM_PRIM_NOK;
732 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
733 RgMiLrgCntrlCfm(&cfmPst, &cfm);
734 RLOG1(L_ERROR, "invalid elmnt=%d",cntrl->hdr.elmId.elmnt);
738 }/*-- RgMiLrgCntrlReq --*/
742 * @brief SAP Configuration Handler.
746 * Function : rgLMMSapCfg
748 * This function in called by RgMiLrgCfgReq(). It handles the
749 * interface SAP configuration of the LTE MAC layer. It
750 * initializes the sapState to LRG_UNBND. Returns
751 * reason for success/failure of this function.
753 * @param[in] Inst inst
754 * @param[in] RgCfg *cfg, the Configuaration information
756 * -# LCM_REASON_GENCFG_NOT_DONE
757 * -# LCM_REASON_INVALID_SAP
758 * -# LCM_REASON_NOT_APPL
761 PRIVATE U16 rgLMMSapCfg
764 RgCfg *cfg, /* Configuaration information */
765 Elmnt sapType /* Sap Type */
768 PRIVATE U16 rgLMMSapCfg(inst,cfg,sapType)
770 RgCfg *cfg; /* Configuaration information */
771 Elmnt sapType; /* Sap Type */
774 U16 ret = LCM_REASON_NOT_APPL;
775 RgLowSapCfgInfo *lowSapCfg = NULLP;
776 RgUpSapCfgInfo *upSapCfg = NULLP;
777 RgUpSapCb *upSapCb = NULLP;
781 /* Check if Gen Config has been done */
782 if(rgCb[inst].rgInit.cfgDone != TRUE)
783 RETVALUE(LCM_REASON_GENCFG_NOT_DONE);
788 if ((cfg->s.rguSap.spId > LRG_MAX_RGU_SAPS) &&
789 (cfg->s.rguSap.selector != RGU_SEL_TC) &&
790 (cfg->s.rguSap.selector != RGU_SEL_LC))
792 ret = LCM_REASON_INVALID_PAR_VAL;
793 RLOG0(L_ERROR, "unsupported Selector value for RGU");
796 upSapCb = &(rgCb[inst].rguSap[cfg->s.rguSap.spId]);
797 if(upSapCb->sapSta.sapState == LRG_NOT_CFG)
799 upSapCb->sapSta.sapState = LRG_UNBND;
801 upSapCfg = &(upSapCb->sapCfg);
802 upSapCfg->sapPst.dstEnt = cfg->s.rguSap.ent;
803 upSapCfg->sapPst.dstInst = cfg->s.rguSap.inst;
804 upSapCfg->sapPst.dstProcId = cfg->s.rguSap.procId;
805 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
806 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
807 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
808 upSapCfg->sapPst.region = cfg->s.rguSap.mem.region;
809 upSapCfg->sapPst.pool = cfg->s.rguSap.mem.pool;
810 upSapCfg->sapPst.selector = cfg->s.rguSap.selector;
811 upSapCfg->sapPst.route = cfg->s.rguSap.route;
812 upSapCfg->sapPst.intfVer = 0;
813 upSapCfg->sapPst.prior = cfg->s.rguSap.prior;
814 upSapCfg->suId = cfg->s.rguSap.suId;
815 upSapCfg->spId = cfg->s.rguSap.spId;
816 /*T2K uses 2 saps, T3K uses 1 sap. change the rgRguDlSap to 1 only if
817 * there is cfg request with sap is 1*/
820 if ((cfg->s.crgSap.selector != CRG_SEL_TC) &&
821 (cfg->s.crgSap.selector != CRG_SEL_LC))
823 ret = LCM_REASON_INVALID_PAR_VAL;
824 RLOG0(L_ERROR, "unsupported Selector value for CRG");
827 if(rgCb[inst].crgSap.sapSta.sapState == LRG_NOT_CFG)
829 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
831 upSapCfg = &rgCb[inst].crgSap.sapCfg;
833 upSapCfg->sapPst.dstEnt = cfg->s.crgSap.ent;
834 upSapCfg->sapPst.dstInst = cfg->s.crgSap.inst;
835 upSapCfg->sapPst.dstProcId = cfg->s.crgSap.procId;
836 upSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
837 upSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
838 upSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
839 upSapCfg->sapPst.region = cfg->s.crgSap.mem.region;
840 upSapCfg->sapPst.pool = cfg->s.crgSap.mem.pool;
841 upSapCfg->sapPst.selector = cfg->s.crgSap.selector;
842 upSapCfg->sapPst.route = cfg->s.crgSap.route;
843 upSapCfg->sapPst.intfVer = 0;
844 upSapCfg->sapPst.prior = cfg->s.crgSap.prior;
845 upSapCfg->suId = cfg->s.crgSap.suId;
846 upSapCfg->spId = cfg->s.crgSap.spId;
850 if ((cfg->s.tfuSap.selector != TFU_SEL_TC) &&
851 (cfg->s.tfuSap.selector != TFU_SEL_LC))
853 ret = LCM_REASON_INVALID_PAR_VAL;
854 RLOG0(L_ERROR, "unsupported Selector value for TFU");
858 if (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG)
860 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
862 lowSapCfg = &rgCb[inst].tfuSap.sapCfg;
864 lowSapCfg->sapPst.dstEnt = cfg->s.tfuSap.ent;
865 lowSapCfg->sapPst.dstInst = cfg->s.tfuSap.inst;
866 lowSapCfg->sapPst.dstProcId = rgCb[inst].rgInit.procId;
867 lowSapCfg->sapPst.srcEnt = rgCb[inst].rgInit.ent;
868 lowSapCfg->sapPst.srcInst = rgCb[inst].rgInit.inst;
869 lowSapCfg->sapPst.srcProcId = rgCb[inst].rgInit.procId;
870 lowSapCfg->sapPst.region = cfg->s.tfuSap.mem.region;
871 lowSapCfg->sapPst.pool = cfg->s.tfuSap.mem.pool;
872 lowSapCfg->sapPst.selector = cfg->s.tfuSap.selector;
873 lowSapCfg->sapPst.route = cfg->s.tfuSap.route;
874 lowSapCfg->sapPst.intfVer = 0;
875 lowSapCfg->sapPst.prior = cfg->s.tfuSap.prior;
876 lowSapCfg->suId = cfg->s.tfuSap.suId;
877 lowSapCfg->spId = cfg->s.tfuSap.spId;
878 cmMemcpy((U8 *)&lowSapCfg->bndTmr, (U8 *)&cfg->s.tfuSap.bndTmr,
882 /* would never reach here */
890 * @brief General Configuration Handler.
894 * Function : rgLMMGenCfg
896 * This function in called by RgMiLrgCfgReq(). It handles the
897 * general configuration of the LTE MAC layer. It initializes
898 * the hash lists of RgCb. Returns
899 * reason for success/failure of this function.
901 * @param[in] Inst inst
902 * @param[in] RgCfg *cfg, the Configuaration information
904 * -# LCM_REASON_NOT_APPL
905 * -# LCM_REASON_INVALID_MSGTYPE
906 * -# LCM_REASON_MEM_NOAVAIL
909 PRIVATE U16 rgLMMGenCfg
912 RgCfg *cfg /* Configuaration information */
915 PRIVATE U16 rgLMMGenCfg(inst,cfg)
917 RgCfg *cfg; /* Configuaration information */
920 U16 ret = LCM_REASON_NOT_APPL;
924 /* Check if General Configuration is done already */
925 if (rgCb[inst].rgInit.cfgDone == TRUE)
927 RETVALUE(LCM_REASON_INVALID_MSGTYPE);
929 if ((cfg->s.genCfg.lmPst.selector != LRG_SEL_TC) &&
930 (cfg->s.genCfg.lmPst.selector != LRG_SEL_LC))
932 RLOG0(L_ERROR, "unsupported Selector value for RGU");
933 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
935 /* Update the Pst structure for LM interface */
936 cmMemcpy((U8 *)&rgCb[inst].rgInit.lmPst, (U8 *)&cfg->s.genCfg.lmPst,
939 rgCb[inst].rgInit.lmPst.srcProcId = rgCb[inst].rgInit.procId;
940 rgCb[inst].rgInit.lmPst.srcEnt = rgCb[inst].rgInit.ent;
941 rgCb[inst].rgInit.lmPst.srcInst = rgCb[inst].rgInit.inst;
942 rgCb[inst].rgInit.lmPst.event = EVTNONE;
944 rgCb[inst].rgInit.region = cfg->s.genCfg.mem.region;
945 rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool;
946 rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes;
948 macCb.macInst = rgCb[inst].rgInit.inst;
950 /* Initialize SAP States */
951 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
953 if(cfg->s.genCfg.numRguSaps == 0)
955 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Invalid numRguSap.\n"));
959 /* allocate RGR saps */
960 if (SGetSBuf(rgCb[inst].rgInit.region,
961 rgCb[inst].rgInit.pool,
962 (Data **)&rgCb[inst].rguSap,
963 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps)) != ROK)
965 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgGenCfg(): Failed to allocate mem for RGU SAP's.\n"));
968 rgCb[inst].numRguSaps = cfg->s.genCfg.numRguSaps;
970 for (int idx = 0; idx < rgCb[inst].numRguSaps; idx++)
972 rgCb[inst].rguSap[idx].sapSta.sapState = LRG_NOT_CFG;
973 cmMemset((U8 *)&rgCb[inst].rguSap[idx], 0, sizeof(RgUpSapCb));
975 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
976 /* Initialize the timer blocks */
977 cmInitTimers(rgCb[inst].tmrBlk, RG_MAX_TIMER);
978 /* Initialzie the timer queue */
979 cmMemset((U8 *)&rgCb[inst].tmrTq, 0, sizeof(CmTqType)*RG_TQ_SIZE);
980 /* Initialize the timer control point */
981 cmMemset((U8 *)&rgCb[inst].tmrTqCp, 0, sizeof(CmTqCp));
982 rgCb[inst].tmrTqCp.tmrLen = RG_TQ_SIZE;
984 /* Timer Registration request to SSI */
985 if (SRegTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
986 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr) != ROK)
989 RLOG0(L_ERROR, "Failed to register timer");
991 SPutSBuf(rgCb[inst].rgInit.region,
992 rgCb[inst].rgInit.pool,
993 (Data *)rgCb[inst].rguSap,
994 (sizeof(RgUpSapCb) * cfg->s.genCfg.numRguSaps));
996 RETVALUE(LCM_REASON_MEM_NOAVAIL);
999 /* Set Config done in TskInit */
1000 rgCb[inst].rgInit.cfgDone = TRUE;
1006 /***********************************************************
1008 * Func : rgLMMShutdown
1011 * Desc : Handles the MAC layer shutdown request. Calls
1012 * rgCFGFreeCellCb(RgCellCb*) to handle each cellCb deallocation.
1021 **********************************************************/
1023 PRIVATE Void rgLMMShutdown
1028 PRIVATE Void rgLMMShutdown(inst)
1032 RgCellCb *cell = rgCb[inst].cell;
1037 /* Unbind the TFU Sap */
1038 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM)
1040 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1041 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1043 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1045 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1047 if(rgCb[inst].tfuSap.sapSta.sapState == LRG_BND)
1049 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
1050 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1056 for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
1058 rgTOMRlsSf(inst,&cell->subFrms[idx]);
1061 rgCFGFreeCellCb(cell);
1064 /* Deleting the RGU SAPs */
1065 SPutSBuf(rgCb[inst].rgInit.region,
1066 rgCb[inst].rgInit.pool,
1067 (Data *)rgCb[inst].rguSap,
1068 (sizeof(RgUpSapCb) * rgCb[inst].numRguSaps));
1069 rgCb[inst].rguSap = NULLP;
1071 rgCb[inst].inactiveCell = NULLP;
1072 rgCb[inst].cell = NULLP;
1074 /* De-register the Timer Service */
1075 (Void) SDeregTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
1076 (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr);
1078 /* call back the task initialization function to intialize
1079 * the global RgCb Struct */
1080 rgActvInit(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, rgCb[inst].rgInit.region,
1081 rgCb[inst].rgInit.reason);
1087 /***********************************************************
1089 * Func : rgLMMGenCntrl
1092 * Desc : Processes the LM control request for STGEN elmnt.
1101 **********************************************************/
1103 PRIVATE Void rgLMMGenCntrl
1110 PRIVATE Void rgLMMGenCntrl(cntrl, cfm, cfmPst)
1116 Inst inst = (cfmPst->srcInst - RG_INST_START);
1119 cfm->cfm.status = LCM_PRIM_OK;
1120 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1123 switch(cntrl->t.cntrl.action)
1126 /* Action is Enable */
1127 switch(cntrl->t.cntrl.subAction)
1131 rgCb[inst].rgInit.trc = TRUE;
1132 rgCb[inst].trcLen = cntrl->t.cntrl.s.trcLen;
1133 /*Store the response and TransId for sending the Traces */
1134 cmMemcpy((U8 *)&rgCb[inst].genCfg.trcResp.response,
1135 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1136 rgCb[inst].genCfg.trcResp.transId = cntrl->hdr.transId;
1140 /* Enable Unsolicited Status (alarms) */
1141 rgCb[inst].rgInit.usta = TRUE;
1142 /*Store the response and TransId for sending the Alarms */
1143 cmMemcpy((U8 *)&rgCb[inst].genCfg.ustaResp.response,
1144 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1145 rgCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
1148 /* Enable Debug Printing */
1150 rgCb[inst].rgInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1155 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1160 cfm->cfm.status = LCM_PRIM_NOK;
1161 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1162 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1167 /* Action is Diable immidiately */
1168 switch(cntrl->t.cntrl.subAction)
1171 /* Disable Traces */
1172 rgCb[inst].rgInit.trc = FALSE;
1175 /* Disable Unsolicited Status (alarms) */
1176 rgCb[inst].rgInit.usta = FALSE;
1179 /* Disable Debug Printing */
1181 rgCb[inst].rgInit.dbgMask &=~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
1186 rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
1191 cfm->cfm.status = LCM_PRIM_NOK;
1192 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1193 RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
1198 /* Free all the memory dynamically allocated by MAC */
1199 rgLMMShutdown(inst);
1202 cfm->cfm.status = LCM_PRIM_NOK;
1203 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1204 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1207 RgMiLrgCntrlCfm(cfmPst, cfm);
1212 /***********************************************************
1214 * Func : rgLMMSapCntrl
1217 * Desc : Processes the LM control request for STxxxSAP elmnt.
1226 **********************************************************/
1228 PRIVATE Void rgLMMSapCntrl
1235 PRIVATE Void rgLMMSapCntrl(cntrl, cfm, cfmPst)
1241 Inst inst = cfmPst->srcInst - RG_INST_START;
1244 /* Only TFU Sap can be controlled by LM */
1245 switch(cntrl->hdr.elmId.elmnt)
1248 switch(cntrl->t.cntrl.action)
1251 /* Bind Enable Request */
1252 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1253 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1255 cfm->cfm.status = LCM_PRIM_NOK;
1256 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
1260 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1262 rgLMMStartTmr(inst,RG_BNDREQ_TMR, rgCb[inst].tfuSap.sapCfg.bndTmr.val,
1263 (PTR)&rgCb[inst].tfuSap);
1265 /* Change SAP state */
1266 rgCb[inst].tfuSap.sapSta.sapState = LRG_WAIT_BNDCFM;
1267 rgCb[inst].tfuSap.numBndRetries++;
1268 /* Store the response and TransId for sending
1269 * the Control confirm */
1270 cmMemcpy((U8 *)&rgCb[inst].genCfg.bndCfmResp.response,
1271 (U8 *)&cntrl->hdr.response, sizeof(Resp));
1272 rgCb[inst].genCfg.bndCfmResp.transId = cntrl->hdr.transId;
1274 /* Sending Status Indication to Layer Manager */
1275 cfm->cfm.status = LCM_PRIM_OK_NDONE;
1276 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1277 RgMiLrgCntrlCfm(cfmPst, cfm);
1279 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1280 rgCb[inst].tfuSap.sapCfg.spId);
1285 /* Unbind request */
1287 /* Check if the SAP is configured */
1288 if( (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
1289 (rgCb[inst].tfuSap.sapSta.sapState == LRG_UNBND))
1291 cfm->cfm.status = LCM_PRIM_NOK;
1292 cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
1296 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1297 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1299 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1301 /* Change SAP state */
1302 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1303 cfm->cfm.status = LCM_PRIM_OK;
1304 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1308 /* Delete SAP, does initialization of SAP */
1309 if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM) ||
1310 (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
1312 rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
1313 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1315 rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1318 cmMemset((U8 *)&rgCb[inst].tfuSap, 0, sizeof(RgLowSapCb));
1319 rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
1320 cfm->cfm.status = LCM_PRIM_OK;
1321 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1324 cfm->cfm.status = LCM_PRIM_NOK;
1325 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1326 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1327 cntrl->t.cntrl.action));
1332 switch(cntrl->t.cntrl.action)
1335 cmMemset((U8 *)&rgCb[inst].rguSap[cntrl->t.cntrl.instId], 0, sizeof(RgUpSapCb));
1336 rgCb[inst].rguSap[cntrl->t.cntrl.instId].sapSta.sapState = LRG_NOT_CFG;
1337 cfm->cfm.status = LCM_PRIM_OK;
1338 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1341 cfm->cfm.status = LCM_PRIM_NOK;
1342 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1343 RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
1344 cntrl->t.cntrl.action));
1349 switch(cntrl->t.cntrl.action)
1352 cmMemset((U8 *)&rgCb[inst].crgSap, 0, sizeof(RgUpSapCb));
1353 rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
1354 cfm->cfm.status = LCM_PRIM_OK;
1355 cfm->cfm.reason = LCM_REASON_NOT_APPL;
1358 cfm->cfm.status = LCM_PRIM_NOK;
1359 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
1360 RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
1366 /* Would never here. */
1369 RgMiLrgCntrlCfm(cfmPst, cfm);
1374 /***********************************************************
1376 * Func : rgLMMFillCfmPst
1379 * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
1380 * and the cfm->hdr.response.
1389 **********************************************************/
1391 PRIVATE Void rgLMMFillCfmPst
1398 PRIVATE Void rgLMMFillCfmPst(reqPst, cfmPst, cfm)
1405 TRC2(rgLMMFillCfmPst)
1406 inst = (reqPst->dstInst - RG_INST_START);
1408 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
1409 cfmPst->srcInst = rgCb[inst].rgInit.inst;
1410 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
1411 cfmPst->dstEnt = reqPst->srcEnt;
1412 cfmPst->dstInst = reqPst->srcInst;
1413 cfmPst->dstProcId = reqPst->srcProcId;
1415 cfmPst->selector = cfm->hdr.response.selector;
1416 cfmPst->prior = cfm->hdr.response.prior;
1417 cfmPst->route = cfm->hdr.response.route;
1418 cfmPst->region = cfm->hdr.response.mem.region;
1419 cfmPst->pool = cfm->hdr.response.mem.pool;
1426 * @brief Timer start handler.
1430 * Function : rgLMMStartTmr
1432 * This function based on the input parameters starts the timer for
1433 * "tmrVal" duration. As of now MAC uses the timer functionality for
1434 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1436 * @param[in] Inst inst
1437 * @param[in] S16 tmrEvnt, the Timer Event
1438 * @param[in] U32 tmrVal, the Wait Time
1439 * @param[in] PTR cb, Entry for which Timer expired
1444 PUBLIC S16 rgLMMStartTmr
1447 S16 tmrEvnt, /* Timer Event */
1448 U32 tmrVal, /* Wait Time */
1449 PTR cb /* Entry for which Timer Expired */
1452 PUBLIC S16 rgLMMStartTmr(tmrEvnt, tmrVal, cb)
1454 S16 tmrEvnt; /* Timer Event */
1455 U32 tmrVal; /* Wait Time */
1456 PTR cb; /* Entry for which Timer Expired */
1465 /* Initialize the arg structure */
1466 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1468 arg.tqCp = &rgCb[inst].tmrTqCp;
1469 arg.tq = rgCb[inst].tmrTq;
1470 arg.timers = rgCb[inst].tmrBlk;
1473 arg.max = RG_MAX_TIMER;
1474 arg.evnt = RG_BNDREQ_TMR;
1483 * @brief Timer stop handler.
1487 * Function : rgLMMStopTmr
1489 * This function based on the input parameters stops the timer for
1490 * "tmrEvnt". As of now MAC uses the timer functionality for
1491 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1492 * Once the bind happens and this timer is stopped, the timer functionality
1493 * is deregistered with SSI. As there is no further use of timer processing.
1495 * @param[in] Inst inst
1496 * @param[in] S16 tmrEvnt, the Timer Event
1497 * @param[in] PTR cb, Entry for which Timer expired
1503 PUBLIC S16 rgLMMStopTmr
1505 Inst inst, /* Scheduler instance */
1506 S16 tmrEvnt, /* Timer Event */
1507 PTR cb /* Entry for which Timer Expired */
1510 PUBLIC S16 rgLMMStopTmr(inst,tmrEvnt, cb)
1511 Inst inst; /* Scheduler instance */
1512 S16 tmrEvnt; /* Timer Event */
1513 PTR cb; /* Entry for which Timer Expired */
1524 for(i=0;i<RG_MAX_TIMER;i++)
1526 /* Search for the Timer Blocks */
1527 if(rgCb[inst].tmrBlk[i].tmrEvnt == tmrEvnt)
1529 /* Initialize the arg structure */
1530 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1532 arg.tqCp = &rgCb[inst].tmrTqCp;
1533 arg.tq = rgCb[inst].tmrTq;
1534 arg.timers = rgCb[inst].tmrBlk;
1536 arg.max = RG_MAX_TIMER;
1554 * @brief Timer Expiry handler.
1558 * Function : rgLMMTmrExpiry
1560 * This is a callback function used as an input parameter to cmPrcTmr()
1561 * to check expiry of any timer. In this function, the only concern is
1562 * about tmrEvnt=Bind timer.
1564 * @param[in] PTR cb, Entry for which Timer expired
1565 * @param[in] S16 tmrEvnt, the Timer Event
1570 PUBLIC S16 rgLMMTmrExpiry
1572 PTR cb, /* Pointer to timer control block */
1573 S16 tmrEvnt /* Timer Event */
1576 PUBLIC S16 rgLMMTmrExpiry(cb,tmrEvnt)
1577 PTR cb; /* Pointer to timer control block */
1578 S16 tmrEvnt; /* Timer Event */
1582 RgLowSapCb *tfuSap = (RgLowSapCb *)cb;
1583 Inst inst = tfuSap->sapCfg.sapPst.srcInst - RG_INST_START;
1585 TRC2(rgLMMTmrExpiry)
1591 tfuSap->numBndRetries++;
1592 if(tfuSap->numBndRetries > RG_MAX_BNDRETRY)
1594 rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_FAIL,
1595 LCM_CAUSE_TMR_EXPIRED, NULLP);
1599 /* Restart the bind timer */
1600 if (tfuSap->sapCfg.bndTmr.enb == TRUE)
1602 ret = rgLMMStartTmr(inst,RG_BNDREQ_TMR, tfuSap->sapCfg.bndTmr.val,
1606 /* Send bind request */
1607 rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
1608 rgCb[inst].tfuSap.sapCfg.spId);
1612 RLOG1(L_ERROR, "Invalid tmrEvnt=%d",tmrEvnt);
1622 * @brief Layer Manager Unsolicited Status Indication generation.
1626 * Function : rgLMMStaInd
1628 * This API is used by the other modules of MAC to send a unsolicited
1629 * status indication to the Layer Manager.
1631 * @param[in] Inst inst
1632 * @param[in] U16 category, the Alarm category
1633 * @param[in] U16 event, the Alarm event
1634 * @param[in] U16 cause, the cause of the Alarm
1635 * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
1640 PUBLIC S16 rgLMMStaInd
1649 PUBLIC S16 rgLMMStaInd(inst,category, event, cause, dgn)
1661 if(rgCb[inst].rgInit.usta == FALSE)
1666 cmMemset((U8 *)&usta, 0, sizeof(RgMngmt));
1668 SGetDateTime(&usta.t.usta.cmAlarm.dt);
1669 usta.t.usta.cmAlarm.category = category;
1670 usta.t.usta.cmAlarm.event = event;
1671 usta.t.usta.cmAlarm.cause = cause;
1674 cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn));
1677 rgCb[inst].rgInit.lmPst.selector = rgCb[inst].genCfg.ustaResp.response.selector;
1678 rgCb[inst].rgInit.lmPst.prior = rgCb[inst].genCfg.ustaResp.response.prior;
1679 rgCb[inst].rgInit.lmPst.route = rgCb[inst].genCfg.ustaResp.response.route;
1680 rgCb[inst].rgInit.lmPst.region = rgCb[inst].genCfg.ustaResp.response.mem.region;
1681 rgCb[inst].rgInit.lmPst.pool = rgCb[inst].genCfg.ustaResp.response.mem.pool;
1682 usta.hdr.transId = rgCb[inst].genCfg.ustaResp.transId;
1684 RETVALUE(RgMiLrgStaInd(&rgCb[inst].rgInit.lmPst, &usta));
1689 * @brief Layer Manager Trace Indication generation.
1693 * Function : rgLMMTrcInd
1695 * This API is used by the other modules of MAC to send a
1696 * Trace indication to the Layer Manager.
1698 * @param[in] Inst inst
1699 * @param[in] Buffer *srcMbuf, the Message Buffer .
1700 * @param[in] U8 event, the trace event.
1704 PUBLIC Void rgLMMTrcInd
1707 Buffer *srcMbuf, /* Message Buffer */
1708 U8 event /* event */
1711 PUBLIC Void rgLMMTrcInd(inst,srcMbuf,event)
1713 Buffer *srcMbuf; /* Message Buffer */
1714 U8 event; /* event */
1717 Buffer *dstMbuf = NULLP;
1727 if ((rgCb[inst].trcLen == LRG_NO_TRACE) || (srcMbuf == NULLP))
1729 RLOG0(L_ERROR, "Trace Disabled.");
1733 cmMemset((U8 *)&trc, 0, sizeof(RgMngmt));
1735 pst = rgCb[inst].rgInit.lmPst;
1736 pst.selector = rgCb[inst].genCfg.trcResp.response.selector;
1737 pst.prior = rgCb[inst].genCfg.trcResp.response.prior;
1738 pst.route = rgCb[inst].genCfg.trcResp.response.route;
1739 pst.region = rgCb[inst].genCfg.trcResp.response.mem.region;
1740 pst.pool = rgCb[inst].genCfg.trcResp.response.mem.pool;
1742 trc.hdr.transId = rgCb[inst].genCfg.trcResp.transId;
1744 SGetDateTime(&trc.t.trc.dt);
1746 /* Check if the whole buffer is to be sent in Trace indication */
1747 if(rgCb[inst].trcLen == LRG_FULL_TRACE)
1749 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1752 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1755 trc.cfm.status = LCM_PRIM_OK;
1756 trc.cfm.reason = LCM_REASON_NOT_APPL;
1757 trc.t.trc.evnt = event;
1759 /* Send Trace Indication to Layer manager */
1760 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1762 /* check if only a specified number of bytes are to be sent */
1763 else if(rgCb[inst].trcLen > 0)
1765 /* Get the length of the recvd message buffer */
1766 if (SFndLenMsg(srcMbuf, &bufLen) != ROK)
1768 RLOG0(L_ERROR, "SFndLenMsg Failed.");
1771 /* Check if the recvd buffer size is less than request trace len */
1772 if(bufLen < rgCb[inst].trcLen)
1774 /* Copy the whole of the recvd buffer in trace indication */
1776 if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
1779 RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
1783 trc.cfm.status = LCM_PRIM_OK;
1784 trc.cfm.reason = LCM_REASON_NOT_APPL;
1785 trc.t.trc.evnt = event;
1787 /* Send Trace Indication to Layer manager */
1788 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1790 /* if the recvd buffer size is greater than request trace len */
1791 if(bufLen >= rgCb[inst].trcLen)
1793 /* Get a temporary buffer to store the msg */
1794 if (rgAllocSBuf(inst,&tempBuf, rgCb[inst].trcLen) != ROK)
1796 RLOG0(L_ERROR, "rgAllocSBuf Failed.");
1800 /* Copy trcLen nos of bytes from the recvd message */
1801 if (SCpyMsgFix(srcMbuf,0,rgCb[inst].trcLen,tempBuf,&tempCnt) != ROK)
1803 RLOG0(L_ERROR, "SCpyMsgFix Failed.");
1807 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
1809 RLOG0(L_ERROR, "dstMbuf Allocation Failed");
1812 /* Copy the tempBuf data to dst mBuf */
1813 if (SCpyFixMsg(tempBuf,dstMbuf,0,rgCb[inst].trcLen,&tempCnt) != ROK)
1815 RLOG0(L_ERROR, "SCpyFixMsg Failed.");
1819 /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
1821 /* Free the memory allocated for tempBuf */
1822 rgFreeSBuf(inst,&tempBuf, rgCb[inst].trcLen);
1824 trc.cfm.status = LCM_PRIM_OK;
1825 trc.cfm.reason = LCM_REASON_NOT_APPL;
1826 trc.t.trc.evnt = event;
1828 /* Send Trace Indication to Layer manager */
1829 RgMiLrgTrcInd(&pst, &trc, dstMbuf);
1837 * @brief Layer Manager Control Confirm generation handler
1838 * for Bind Confirm reception at TFU interface.
1839 * RgLiTfuBndCfm() forwards the confirmation to this
1840 * function. All SAP state related handling is restricted
1841 * to LMM modules, hence the cfm forwarding.
1845 * Function : rgLMMBndCfm
1847 * This API is used by the LIM module of MAC to forward
1848 * the Bind Confirm it receives over the TFU interface.
1850 * @param[in] Pst *pst, Post Structure
1851 * @param[in] SuId suId, Service user ID
1852 * @param[in] U8 status, Status
1857 PUBLIC S16 rgLMMBndCfm
1859 Pst *pst, /* Post Structure */
1860 SuId suId, /* Service user ID */
1861 U8 status /* Status */
1864 PUBLIC S16 rgLMMBndCfm(pst,suId,status)
1865 Pst *pst; /* Post Structure */
1866 SuId suId; /* Service user ID */
1867 U8 status; /* Status */
1870 Inst inst = pst->dstInst - RG_INST_START;
1879 /* Check if the suId is valid */
1880 if(rgCb[inst].tfuSap.sapCfg.suId != suId)
1882 RLOG0(L_ERROR, "Invalid SuId");
1886 /* check the Sap State */
1887 switch(rgCb[inst].tfuSap.sapSta.sapState)
1889 case LRG_WAIT_BNDCFM:
1892 /* SAP is already bound */
1898 cfmPst = rgCb[inst].rgInit.lmPst;
1899 cfmPst.selector = rgCb[inst].genCfg.bndCfmResp.response.selector;
1900 cfmPst.prior = rgCb[inst].genCfg.bndCfmResp.response.prior;
1901 cfmPst.route = rgCb[inst].genCfg.bndCfmResp.response.route;
1902 cfmPst.region = rgCb[inst].genCfg.bndCfmResp.response.mem.region;
1903 cfmPst.pool = rgCb[inst].genCfg.bndCfmResp.response.mem.pool;
1905 cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
1909 case CM_BND_OK: /* status is OK */
1910 /* Change SAP state to Bound */
1911 rgCb[inst].tfuSap.sapSta.sapState = LRG_BND;
1912 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1914 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1916 /* Send Control Confirm with status as OK to Layer Manager */
1917 cntrlCfm.cfm.status = LCM_PRIM_OK;
1918 cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
1922 /* Change SAP state to UnBound */
1923 rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
1924 if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
1926 ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
1928 /* Send Control Confirm with status as NOK to Layer Manager */
1929 cntrlCfm.cfm.status = LCM_PRIM_NOK;
1930 cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1933 rgCb[inst].tfuSap.numBndRetries = 0;
1934 cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1935 cntrlCfm.hdr.transId = rgCb[inst].genCfg.bndCfmResp.transId;
1937 ret = RgMiLrgCntrlCfm(&cfmPst, &cntrlCfm);
1944 * @brief LTE MAC timer call back function registered with SSI.
1948 * Function : rgActvTmr
1950 * This function is invoked by SSI for every timer activation
1957 PUBLIC S16 rgActvTmr
1963 PUBLIC S16 rgActvTmr(ent, inst)
1968 Inst macInst = (inst - RG_INST_START);
1971 /* Check if any MAC timer has expired */
1972 cmPrcTmr(&rgCb[macInst].tmrTqCp, rgCb[macInst].tmrTq, (PFV) rgLMMTmrExpiry);
1976 } /* end of rgActvTmr */
1979 * @brief Layer Manager Configuration request handler for Scheduler
1983 * Function : MacSchGenCfgReq
1985 * This function receives general configurations for Scheduler
1986 * from DU APP and forwards to Scheduler.
1988 * @param[in] Pst *pst, the post structure
1989 * @param[in] RgMngmt *cfg, the configuration parameter's structure
1994 PUBLIC int MacSchGenCfgReq
1996 Pst *pst, /* post structure */
1997 RgMngmt *cfg /* config structure */
2000 PUBLIC int MacSchGenCfgReq(pst, cfg)
2001 Pst *pst; /* post structure */
2002 RgMngmt *cfg; /* config structure */
2005 printf("\nReceived Scheduler gen config at MAC");
2006 pst->dstInst = DEFAULT_CELLS + 1;
2007 HandleSchGenCfgReq(pst, cfg);
2013 * @brief Layer Manager Configuration response from Scheduler
2017 * Function : SchSendCfgCfm
2019 * This function sends general configurations response from
2020 * Scheduler to DU APP.
2022 * @param[in] Pst *pst, the post structure
2023 * @param[in] RgMngmt *cfm, the configuration confirm structure
2028 PUBLIC S16 SchSendCfgCfm
2030 Pst *pst, /* post structure */
2031 RgMngmt *cfm /* config confirm structure */
2034 PUBLIC S16 SchSendCfgCfm(pst, cfm)
2035 Pst *pst; /* post structure */
2036 RgMngmt *cfm; /* config confirm structure */
2039 printf("\nSending Scheduler config confirm to DU APP");
2040 pst->dstEnt = ENTDUAPP;
2043 pst->selector = MAC_SCH_LC_SELECTOR;
2044 RgMiLrgSchCfgCfm(pst, cfm);
2050 /***********************************************************
2052 * Func : macCellCfgFillCfmPst
2055 * Desc : Fills the Confirmation Post Structure cfmPst
2063 **********************************************************/
2064 Void macCellCfgFillCfmPst
2071 inst = reqPst->dstInst;
2073 cfmPst->srcEnt = rgCb[inst].rgInit.ent;
2074 cfmPst->srcInst = rgCb[inst].rgInit.inst;
2075 cfmPst->srcProcId = rgCb[inst].rgInit.procId;
2077 cfmPst->dstEnt = ENTDUAPP;
2078 cfmPst->dstInst = 0;
2079 cfmPst->dstProcId = cfmPst->srcProcId;
2081 cfmPst->selector = LRG_SEL_LC;
2082 cfmPst->prior = reqPst->prior;
2083 cfmPst->route = reqPst->route;
2084 cfmPst->region = reqPst->region;
2085 cfmPst->pool = reqPst->pool;
2086 cfmPst->event = EVENT_MAC_CELL_CONFIG_CFM;
2092 * @brief Layer Manager Configuration request handler.
2096 * Function : MacHdlCellCfgReq
2098 * This function handles the gNB and cell configuration
2099 * request received from DU APP.
2100 * This API unapcks and forwards the config towards SCH
2102 * @param[in] Pst *pst
2103 * @param[in] MacCellCfg *macCellCfg
2107 int MacHdlCellCfgReq
2110 MacCellCfg *macCellCfg
2116 MacCellCb *macCellCb;
2117 Inst inst = pst->dstInst;
2119 cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
2120 MAC_ALLOC(cellCb,sizeof(RgCellCb));
2124 DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n");
2128 memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
2129 rgCb[inst].cell = cellCb;
2131 MAC_ALLOC(macCellCb,sizeof(MacCellCb));
2132 if(macCellCb == NULLP)
2134 DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
2137 macCb.macCell = macCellCb;
2138 macCb.macCell->cellId = macCellCfg->cellId;
2139 /* Send cell cfg to scheduler */
2140 ret = MacSchCellCfgReq(pst, macCellCfg);
2143 MacCellCfgCfm macCellCfgCfm;
2144 macCellCfgCfm.rsp = RSP_NOK;
2145 macCellCfgCfm.transId = macCellCfg->transId;
2146 macCellCfgFillCfmPst(pst,&cfmPst);
2147 ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
2150 LwrMacEnqueueWlsBlock();
2153 } /* end of MacHdlCellCfgReq */
2156 * @brief Layer Manager Configuration request handler.
2160 * Function : MacSchCellCfgReq
2162 * This function sends cell configuration to SCH
2164 * @param[in] Pst *pst
2165 * @param[in] MacCellCfg *macCellCfg
2169 int MacSchCellCfgReq
2172 MacCellCfg *macCellCfg
2175 SchCellCfg schCellCfg;
2179 cmMemset((U8 *)&cfgPst, 0, sizeof(Pst));
2180 schCellCfg.cellId = macCellCfg->cellId;
2181 schCellCfg.phyCellId = macCellCfg->phyCellId;
2182 schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
2183 schCellCfg.dupMode = macCellCfg->dupType;
2185 /* fill ssb scheduler parameters */
2186 schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
2187 schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
2188 schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
2189 schCellCfg.ssbSchCfg.ssbPeriod = macCellCfg->ssbCfg.ssbPeriod;
2190 schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
2191 for(uint8_t idx=0; idx<SSB_MASK_SIZE; idx++)
2193 schCellCfg.ssbSchCfg.nSSBMask[idx] = macCellCfg->ssbCfg.ssbMask[idx];
2196 /* fill SIB1 scheduler parameters */
2197 schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen;
2198 schCellCfg.sib1SchCfg.sib1NewTxPeriod = macCellCfg->sib1Cfg.sib1NewTxPeriod;
2199 schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod;
2200 schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex;
2201 schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex;
2202 schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs;
2204 /* fill RACH config params */
2205 schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
2206 schCellCfg.schRachCfg.prachSubcSpacing = \
2207 macCellCfg->prachCfg.prachSubcSpacing;
2208 schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
2209 schCellCfg.schRachCfg.msg1Fdm = macCellCfg->prachCfg.msg1Fdm;
2210 schCellCfg.schRachCfg.rootSeqIdx = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
2211 schCellCfg.schRachCfg.numRootSeq = macCellCfg->prachCfg.fdm[0].numRootSeq;
2212 schCellCfg.schRachCfg.k1 = macCellCfg->prachCfg.fdm[0].k1;
2213 schCellCfg.schRachCfg.ssbPerRach = macCellCfg->prachCfg.ssbPerRach;
2214 schCellCfg.schRachCfg.prachMultCarrBand = \
2215 macCellCfg->prachCfg.prachMultCarrBand;
2216 schCellCfg.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr;
2217 schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
2218 schCellCfg.schRachCfg.raRspWindow = macCellCfg->prachCfg.raRspWindow;
2220 /* fill initial DL BWP */
2221 schCellCfg.schInitialBwp.bwp.firstPrb = macCellCfg->initialBwp.bwp.firstPrb;
2222 schCellCfg.schInitialBwp.bwp.numPrb = macCellCfg->initialBwp.bwp.numPrb;
2223 schCellCfg.schInitialBwp.bwp.scs = macCellCfg->initialBwp.bwp.scs;
2224 schCellCfg.schInitialBwp.bwp.cyclicPrefix = macCellCfg->initialBwp.bwp.cyclicPrefix;
2225 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.searchSpaceId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.searchSpaceId;
2226 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.coresetId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.coresetId;
2227 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSlot = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSlot;
2228 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.duration = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.duration;
2229 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSymbol = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSymbol;
2230 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1;
2231 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2;
2232 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4;
2233 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8;
2234 schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16;
2236 cfgPst.srcProcId = pst->dstProcId;
2237 cfgPst.dstProcId = pst->srcProcId;
2238 cfgPst.srcEnt = ENTRG;
2240 cfgPst.dstEnt = ENTRG;
2242 cfgPst.selector = MAC_SCH_TC_SELECTOR;
2243 cfgPst.event = EVENT_SCH_CELL_CFG;
2245 ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg);
2247 } /* end of MacSchCellCfgReq */
2250 /*******************************************************************
2252 * @brief Sends Cell config confirm to DU APP
2256 * Function : MacSendCellCfgCfm
2259 * Sends Cell config confirm to DU APP
2261 * @params[in] Response status
2264 * ****************************************************************/
2265 void MacSendCellCfgCfm(uint8_t response)
2269 MacCellCfgCfm macCellCfgCfm;
2271 cmMemset((U8 *)&pst, 0, sizeof(Pst));
2272 cellCb = rgCb[macCb.macInst].cell;
2274 macCellCfgCfm.transId = cellCb->macCellCfg.transId;
2275 macCellCfgCfm.rsp = response;
2277 memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
2278 pst.event = EVENT_MAC_CELL_CONFIG_CFM;
2279 (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
2284 * @brief Layer Manager Configuration response handler.
2288 * Function : MacProcSchCellCfgCfm
2290 * This function processes cell configuration to SCH
2292 * @param[in] Pst *pst
2293 * @param[in] SchCellCfgCfm *schCellCfgCfm
2297 int MacProcSchCellCfgCfm
2300 SchCellCfgCfm *schCellCfgCfm
2303 if(schCellCfgCfm->rsp == RSP_OK)
2305 sendToLowerMac(CONFIG_REQUEST, 0, (void *)NULL);
2309 MacSendCellCfgCfm(RSP_NOK);
2314 /**********************************************************************
2317 **********************************************************************/