1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions for slot indications
29 **********************************************************************/
31 /** @file sch_slot_ind.c
32 @brief This module processes slot indications
35 #include "envopt.h" /* environment options */
36 #include "envdep.h" /* environment dependent */
37 #include "envind.h" /* environment independent */
38 #include "gen.h" /* general layer */
39 #include "ssi.h" /* system service interface */
40 #include "cm_tkns.h" /* Common Token Defines */
41 #include "cm_llist.h" /* Common Link List Defines */
42 #include "cm_hash.h" /* Common Hash List Defines */
43 #include "cm_mblk.h" /* common memory link list library */
44 #include "cm_lte.h" /* Common LTE Defines */
48 #include "gen.x" /* general layer typedefs */
49 #include "ssi.x" /* system services typedefs */
50 #include "cm5.x" /* system services */
51 #include "cm_tkns.x" /* Common Token Definitions */
52 #include "cm_llist.x" /* Common Link List Definitions */
53 #include "cm_lib.x" /* Common Library Definitions */
54 #include "cm_hash.x" /* Common Hash List Definitions */
55 #include "cm_mblk.x" /* common memory link list library */
56 #include "cm_lte.x" /* Common LTE Defines */
60 #include "du_app_mac_inf.h"
61 #include "mac_sch_interface.h"
64 SchMacDlBrdcstAllocFunc schMacDlBrdcstAllocOpts[] =
66 packSchMacDlBrdcstAlloc,
68 packSchMacDlBrdcstAlloc
71 extern SchCb schCb[SCH_MAX_INST];
74 /*******************************************************************
76 * @brief Handles sending DL broadcast alloc to MAC
80 * Function : sendDlBrdcstAllocToMac
83 * Sends DL Broadcast Resource Allocation to MAC from SCH
86 * @return ROK - success
89 * ****************************************************************/
90 int sendDlBrdcstAllocToMac(DlBrdcstAlloc *dlBrdcstAlloc, Inst inst)
94 memset(&pst, 0, sizeof(Pst));
95 SCH_FILL_RSP_PST(pst, inst);
96 pst.event = EVENT_DL_BRDCST_ALLOC;
98 return(*schMacDlBrdcstAllocOpts[pst.selector])(&pst, dlBrdcstAlloc);
101 /*******************************************************************
103 * @brief Handles slot indication at SCH
107 * Function : schProcessSlotInd
110 * Handles TTI indication received from PHY
113 * @return ROK - success
116 * ****************************************************************/
117 int schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
121 uint16_t sfn = slotInd->sfn;
122 uint16_t slot = slotInd->slot;
123 uint16_t sfnSlot = 0;
124 DlBrdcstAlloc dlBrdcstAlloc;
125 dlBrdcstAlloc.ssbTrans = NO_SSB;
126 dlBrdcstAlloc.sib1Trans = NO_SIB1;
133 cell = schCb[schInst].cells[schInst];
134 // schDlResAlloc(cell, slotInd);
136 ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
137 memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
138 dlBrdcstAlloc.cellId = cell->cellId;
139 dlBrdcstAlloc.ssbIdxSupported = 1;
141 if((slot + SCHED_DELTA) >= 10)
145 slot = ((slot + SCHED_DELTA) % 10 );
146 sfnSlot = ((sfn * 10) + slot);
148 dlBrdcstAlloc.slotIndInfo.sfn = sfn;
149 dlBrdcstAlloc.slotIndInfo.slot = slot;
151 /* Identify SSB ocassion*/
152 if (sfnSlot % SCH_MIB_TRANS == 0)
154 dlBrdcstAlloc.ssbTrans = SSB_TRANSMISSION;
156 else if (sfnSlot % ssb_rep == 0)
158 dlBrdcstAlloc.ssbTrans = SSB_REPEAT;
162 /* not SSB occassion */
165 /* Identify SIB1 occasions */
166 if(sfnSlot % cell->cellCfg.sib1SchCfg.sib1NewTxPeriod == 0)
168 dlBrdcstAlloc.sib1Trans = SIB1_TRANSMISSION;
170 else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0)
172 dlBrdcstAlloc.sib1Trans = SIB1_REPITITION;
176 /* not SIB1 occassion */
179 if(dlBrdcstAlloc.ssbTrans || dlBrdcstAlloc.sib1Trans)
181 ret = schCmnDlAlloc(cell, &dlBrdcstAlloc);
184 DU_LOG("\nschCmnDlAlloc failed");
189 ret = sendDlBrdcstAllocToMac(&dlBrdcstAlloc, schInst);
192 DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed");
196 schUlResAlloc(cell, schInst);
201 /**********************************************************************
203 **********************************************************************/