1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions
29 **********************************************************************/
31 /** @file sch_common.c
32 @brief This module performs common scheduling
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 extern SchCb schCb[SCH_MAX_INST];
67 * @brief Time domain allocation for SSB
71 * Function : ssbDlTdAlloc
73 * This function handles common scheduling for DL
75 * @param[in] schCellCb *cell, cell cb
76 * @param[in] DlBrdcstAlloc *dlBrdcstAlloc, DL brdcst allocation
79 void ssbDlTdAlloc(uint8_t scs, uint8_t *ssbStartSymb)
82 /* Determine value of "n" based on Section 4.1 of 3GPP TS 38.213 */
88 n = 2;/* n = 0, 1 for SCS = 15KHz */
89 for(uint8_t idx=0; idx<n; idx++)
91 /* start symbol determined using {2, 8} + 14n */
92 ssbStartSymb[symbIdx++] = 2 + SCH_SYMBOL_PER_SLOT*idx;
93 ssbStartSymb[symbIdx++] = 8 + SCH_SYMBOL_PER_SLOT*idx;
98 DU_LOG("\nSCS %d is currently not supported", scs);
102 * @brief common resource allocation for SSB
106 * Function : schCmnDlAlloc
108 * This function handles common scheduling for DL
110 * @param[in] SchCellCb *cell, cell cb
111 * @param[in] DlBrdcstAlloc *dlBrdcstAlloc, DL brdcst allocation
114 uint8_t schCmnDlAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc)
117 uint8_t scs, ssbStartPrb, ssbStartSymb, idx;
118 uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM];
122 dlAlloc = cell->dlAlloc[cell->slotInfo.slot];
123 if(dlBrdcstAlloc->ssbTrans)
125 scs = cell->cellCfg.ssbSchCfg.scsCommon;
127 (cell->cellCfg.ssbSchCfg.ssbOffsetPointA)/SCH_NUM_SC_PRB;
129 memset(ssbStartSymbArr, 0, SCH_MAX_SSB_BEAM);
130 ssbDlTdAlloc(scs, ssbStartSymbArr);
131 ssbStartSymb = ssbStartSymbArr[dlBrdcstAlloc->ssbIdxSupported-1]; /*since we are supporting only 1 ssb beam */
132 /* Assign interface structure */
133 for(idx=0; idx<dlBrdcstAlloc->ssbIdxSupported; idx++)
135 ssbInfo.ssbIdx = idx;
136 ssbInfo.fdAlloc.ssbStartPrbIdx = ssbStartPrb;
137 ssbInfo.fdAlloc.ssbPrbDuration = SCH_SSB_PRB_DURATION;
138 ssbInfo.tdAlloc.ssbStartSymbIdx = ssbStartSymb;
139 ssbInfo.tdAlloc.ssbSymbolDuration = SCH_SSB_SYMB_DURATION;
140 dlBrdcstAlloc->ssbInfo[idx] = ssbInfo;
141 dlAlloc->ssbInfo[idx] = ssbInfo;
145 dlAlloc->ssbPres = true;
146 dlAlloc->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported;
147 for(idx=ssbStartSymb; idx<ssbStartSymb+SCH_SSB_SYMB_DURATION; idx++)
149 dlAlloc->assignedPrb[idx] = SCH_SSB_PRB_DURATION + 1; /* +1 for kSsb */
154 /* SIB1 allocation */
155 if(dlBrdcstAlloc->sib1Trans)
157 memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(Sib1PdcchCfg));
158 memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdschCfg, &cell->cellCfg.sib1SchCfg.sib1PdschCfg, sizeof(Sib1PdschCfg));
164 /**********************************************************************
166 **********************************************************************/