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 scheduler utilities
29 **********************************************************************/
32 @brief This file implements the schedulers util functions.
36 #include "common_def.h"
37 #include "du_app_mac_inf.h"
40 #include "tfu.x" /* TFU types */
41 #include "lrg.x" /* layer management typedefs for MAC */
42 #include "mac_sch_interface.h"
44 #include "sch_utils.h"
48 /* spec-38.213 Table 13-4 for SCS=30KHz */
49 /* Note: Picking Table 13-4 and not 13-6 since band supported is n78 and
50 * corresponding minimum B/W is 10 MHz */
51 int8_t coresetIdxTable[MAX_CORESET_INDEX][4] = {
52 { 1, 24, 2, 0}, /* index 0 */
53 { 1, 24, 2, 1}, /* index 1 */
54 { 1, 24, 2, 2}, /* index 2 */
55 { 1, 24, 2, 3}, /* index 3 */
56 { 1, 24, 2, 4}, /* index 4 */
57 { 1, 24, 3, 0}, /* index 5 */
58 { 1, 24, 3, 1}, /* index 6 */
59 { 1, 24, 3, 2}, /* index 7 */
60 { 1, 24, 3, 3}, /* index 8 */
61 { 1, 24, 3, 4}, /* index 9 */
62 { 1, 48, 1, 12}, /* index 10 */
63 { 1, 48, 1, 14}, /* index 11 */
64 { 1, 48, 1, 16}, /* index 12 */
65 { 1, 48, 2, 12}, /* index 13 */
66 { 1, 48, 2, 14}, /* index 14 */
67 { 1, 48, 2, 16}, /* index 15 */
70 /* spec-38.213 Table 13-1 for SCS=15KHz */
71 int8_t coresetIdxTable[MAX_CORESET_INDEX][4] = {
72 { 1, 24, 2, 0}, /* index 0 */
73 { 1, 24, 2, 2}, /* index 1 */
74 { 1, 24, 2, 4}, /* index 2 */
75 { 1, 24, 3, 0}, /* index 3 */
76 { 1, 24, 3, 2}, /* index 4 */
77 { 1, 24, 3, 4}, /* index 5 */
78 { 1, 48, 1, 12}, /* index 6 */
79 { 1, 48, 1, 16}, /* index 7 */
80 { 1, 48, 2, 12}, /* index 8 */
81 { 1, 48, 2, 16}, /* index 9 */
82 { 1, 48, 3, 12}, /* index 10 */
83 { 1, 48, 3, 16}, /* index 11 */
84 { 1, 96, 1, 38}, /* index 12 */
85 { 1, 96, 2, 38}, /* index 13 */
86 { 1, 96, 3, 38}, /* index 14 */
87 { 0, 0, 0, 0}, /* index 15 */
91 /* spec-38.213 Table 13-11 */
92 /* m value is scaled to 2, when using it in formula, divide by 2 */
93 /* firstSymbol will vary depends on i, hence not filled */
94 int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4] = {
95 { 0, 1, 2, 0}, /* index 0 */
96 { 0, 2, 1, 0}, /* index 1 */
97 { 2, 1, 2, 0}, /* index 2 */
98 { 2, 2, 1, 0}, /* index 3 */
99 { 5, 1, 2, 0}, /* index 4 */
100 { 5, 2, 1, 0}, /* index 5 */
101 { 7, 1, 2, 0}, /* index 6 */
102 { 7, 2, 1, 0}, /* index 7 */
103 { 0, 1, 4, 0}, /* index 8 */
104 { 5, 1, 4, 0}, /* index 9 */
105 { 0, 1, 2, 0}, /* index 10 */
106 { 0, 1, 2, 0}, /* index 11 */
107 { 2, 1, 2, 0}, /* index 12 */
108 { 2, 1, 2, 0}, /* index 13 */
109 { 5, 1, 2, 0}, /* index 14 */
110 { 5, 1, 2, 0}, /* index 15 */
115 /* spec-38.211 Table 6.3.3.2-1 */
116 /* Lra, delFRa, delF, numRb, k' */
117 uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5] = {
118 { 839, 1.25, 15, 6, 7 }, /* index 0 */
119 { 839, 1.25, 30, 3, 1 }, /* index 1 */
120 { 839, 1.25, 60, 2, 133 }, /* index 2 */
121 { 839, 5, 15, 24, 12 }, /* index 3 */
122 { 839, 5, 30, 12, 10 }, /* index 4 */
123 { 839, 5, 60, 6, 7 }, /* index 5 */
124 { 139, 15, 15, 12, 2 }, /* index 6 */
125 { 139, 15, 30, 6, 2 }, /* index 7 */
126 { 139, 15, 60, 3, 2 }, /* index 8 */
127 { 139, 30, 15, 24, 2 }, /* index 9 */
128 { 139, 30, 30, 12, 2 }, /* index 10 */
129 { 139, 30, 60, 6, 2 }, /* index 11 */
130 { 139, 60, 60, 12, 2 }, /* index 12 */
131 { 139, 60, 120, 6, 2 }, /* index 13 */
132 { 139, 120, 60, 24, 2 }, /* index 14 */
133 { 139, 120, 120, 12, 2 }, /* index 15 */
138 /* prach config index Table 6.3.3.2-3 spec 38.211
139 * PRACH format given as follows:
154 * Subframe num is represented considering 0-9 bits and
155 * value 1 corresponds to the subframe that is valid
158 uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
159 { 0, 16, 1, 512, 0, 0, 0, 0 }, /* index 0 */
160 { 0, 8, 1, 512, 0, 0, 0, 0 }, /* index 1 */
161 { 0, 4, 1, 512, 0, 0, 0, 0 }, /* index 2 */
162 { 0, 2, 0, 512, 0, 0, 0, 0 }, /* index 3 */
163 { 0, 2, 1, 512, 0, 0, 0, 0 }, /* index 4 */
164 { 0, 2, 0, 16, 0, 0, 0, 0 }, /* index 5 */
165 { 0, 2, 1, 16, 0, 0, 0, 0 }, /* index 6 */
166 { 0, 1, 0, 512, 0, 0, 0, 0 }, /* index 7 */
167 { 0, 1, 0, 256, 0, 0, 0, 0 }, /* index 8 */
168 { 0, 1, 0, 128, 0, 0, 0, 0 }, /* index 9 */
169 { 0, 1, 0, 64, 0, 0, 0, 0 }, /* index 10 */
170 { 0, 1, 0, 32, 0, 0, 0, 0 }, /* index 11 */
171 { 0, 1, 0, 16, 0, 0, 0, 0 }, /* index 12 */
172 { 0, 1, 0, 8, 0, 0, 0, 0 }, /* index 13 */
173 { 0, 1, 0, 4, 0, 0, 0, 0 }, /* index 14 */
174 { 0, 1, 0, 66, 0, 0, 0, 0 }, /* index 15 */
175 { 0, 1, 0, 66, 7, 0, 0, 0 }, /* index 16 */
176 { 0, 1, 0, 528, 0, 0, 0, 0 }, /* index 17 */
177 { 0, 1, 0, 264, 0, 0, 0, 0 }, /* index 18 */
178 { 0, 1, 0, 132, 0, 0, 0, 0 }, /* index 19 */
179 { 0, 1, 0, 768, 0, 0, 0, 0 }, /* index 20 */
180 { 0, 1, 0, 784, 0, 0, 0, 0 }, /* index 21 */
181 { 0, 1, 0, 536, 0, 0, 0, 0 }, /* index 22 */
182 { 0, 1, 0, 896, 0, 0, 0, 0 }, /* index 23 */
183 { 0, 1, 0, 792, 0, 0, 0, 0 }, /* index 24 */
184 { 0, 1, 0, 960, 0, 0, 0, 0 }, /* index 25 */
185 { 0, 1, 0, 594, 0, 0, 0, 0 }, /* index 26 */
186 { 0, 1, 0, 682, 0, 0, 0, 0 }, /* index 27 */
187 { 1, 16, 1, 128, 0, 0, 0, 0 }, /* index 28 */
188 { 1, 8, 1, 128, 0, 0, 0, 0 }, /* index 29 */
189 { 1, 4, 1, 128, 0, 0, 0, 0 }, /* index 30 */
190 { 1, 2, 0, 128, 0, 0, 0, 0 }, /* index 31 */
191 { 1, 2, 1, 128, 0, 0, 0, 0 }, /* index 32 */
192 { 1, 1, 0, 128, 0, 0, 0, 0 }, /* index 33 */
193 { 2, 16, 1, 64, 0, 0, 0, 0 }, /* index 34 */
194 { 2, 8, 1, 64, 0, 0, 0, 0 }, /* index 35 */
195 { 2, 4, 1, 64, 0, 0, 0, 0 }, /* index 36 */
196 { 2, 2, 0, 64, 7, 0, 0, 0 }, /* index 37 */
197 { 2, 2, 1, 64, 7, 0, 0, 0 }, /* index 38 */
198 { 2, 1, 0, 64, 7, 0, 0, 0 }, /* index 39 */
199 { 3, 16, 1, 512, 0, 0, 0, 0 }, /* index 40 */
200 { 3, 8, 1, 512, 0, 0, 0, 0 }, /* index 41 */
201 { 3, 4, 1, 512, 0, 0, 0, 0 }, /* index 42 */
202 { 3, 2, 0, 512, 0, 0, 0, 0 }, /* index 43 */
203 { 3, 2, 1, 512, 0, 0, 0, 0 }, /* index 44 */
204 { 3, 2, 0, 16, 0, 0, 0, 0 }, /* index 45 */
205 { 3, 2, 1, 16, 0, 0, 0, 0 }, /* index 46 */
206 { 3, 1, 0, 512, 0, 0, 0, 0 }, /* index 47 */
207 { 3, 1, 0, 256, 0, 0, 0, 0 }, /* index 48 */
208 { 3, 1, 0, 128, 0, 0, 0, 0 }, /* index 49 */
209 { 3, 1, 0, 64, 0, 0, 0, 0 }, /* index 50 */
210 { 3, 1, 0, 32, 0, 0, 0, 0 }, /* index 51 */
211 { 3, 1, 0, 16, 0, 0, 0, 0 }, /* index 52 */
212 { 3, 1, 0, 8, 0, 0, 0, 0 }, /* index 53 */
213 { 3, 1, 0, 4, 0, 0, 0, 0 }, /* index 54 */
214 { 3, 1, 0, 66, 0, 0, 0, 0 }, /* index 55 */
215 { 3, 1, 0, 66, 7, 0, 0, 0 }, /* index 56 */
216 { 3, 1, 0, 528, 0, 0, 0, 0 }, /* index 57 */
217 { 3, 1, 0, 264, 0, 0, 0, 0 }, /* index 58 */
218 { 3, 1, 0, 132, 0, 0, 0, 0 }, /* index 59 */
219 { 3, 1, 0, 768, 0, 0, 0, 0 }, /* index 60 */
220 { 3, 1, 0, 784, 0, 0, 0, 0 }, /* index 61 */
221 { 3, 1, 0, 536, 0, 0, 0, 0 }, /* index 62 */
222 { 3, 1, 0, 896, 0, 0, 0, 0 }, /* index 63 */
223 { 3, 1, 0, 792, 0, 0, 0, 0 }, /* index 64 */
224 { 3, 1, 0, 594, 0, 0, 0, 0 }, /* index 65 */
225 { 3, 1, 0, 682, 0, 0, 0, 0 }, /* index 66 */
226 { 4, 16, 1, 512, 0, 2, 6, 2 }, /* index 67 */
227 { 4, 8, 1, 512, 0, 2, 6, 2 }, /* index 68 */
228 { 4, 4, 1, 512, 0, 1, 6, 2 }, /* index 69 */
229 { 4, 2, 1, 512, 0, 1, 6, 2 }, /* index 70 */
230 { 4, 2, 1, 528, 7, 1, 3, 2 }, /* index 71 */
231 { 4, 2, 1, 640, 7, 1, 3, 2 }, /* index 72 */
232 { 4, 2, 1, 640, 0, 1, 6, 2 }, /* index 73 */
233 { 4, 2, 1, 768, 0, 2, 6, 2 }, /* index 74 */
234 { 4, 2, 1, 528, 0, 2, 6, 2 }, /* index 75 */
235 { 4, 2, 1, 924, 0, 1, 6, 2 }, /* index 76 */
236 { 4, 1, 0, 512, 0, 2, 6, 2 }, /* index 77 */
237 { 4, 1, 0, 512, 7, 1, 3, 2 }, /* index 78 */
238 { 4, 1, 0, 512, 0, 1, 6, 2 }, /* index 79 */
239 { 4, 1, 0, 768, 0, 2, 6, 2 }, /* index 80 */
240 { 4, 1, 0, 528, 0, 1, 6, 2 }, /* index 81 */
241 { 4, 1, 0, 640, 7, 1, 3, 2 }, /* index 82 */
242 { 4, 1, 0, 792, 0, 1, 6, 2 }, /* index 83 */
243 { 4, 1, 0, 792, 0, 2, 6, 2 }, /* index 84 */
244 { 4, 1, 0, 682, 0, 1, 6, 2 }, /* index 85 */
245 { 4, 1, 0, 1023, 7, 1, 3, 2 }, /* index 86 */
246 { 5, 16, 1, 512, 0, 2, 3, 4 }, /* index 87 */
247 { 5, 8, 1, 512, 0, 2, 3, 4 }, /* index 88 */
248 { 5, 4, 1, 512, 0, 1, 3, 4 }, /* index 89 */
249 { 5, 2, 1, 640, 0, 1, 3, 4 }, /* index 90 */
250 { 5, 2, 1, 768, 0, 2, 3, 4 }, /* index 91 */
251 { 5, 2, 1, 640, 9, 1, 1, 4 }, /* index 92 */
252 { 5, 2, 1, 528, 9, 1, 1, 4 }, /* index 93 */
253 { 5, 2, 1, 528, 0, 2, 3, 4 }, /* index 94 */
254 { 5, 2, 1, 924, 0, 1, 3, 4 }, /* index 95 */
255 { 5, 1, 0, 4, 0, 1, 3, 4 }, /* index 96 */
256 { 5, 1, 0, 128, 0, 1, 3, 4 }, /* index 97 */
257 { 5, 2, 1, 512, 0, 1, 3, 4 }, /* index 98 */
258 { 5, 1, 0, 512, 0, 2, 3, 4 }, /* index 99 */
259 { 5, 1, 0, 512, 9, 1, 1, 4 }, /* index 100 */
260 { 5, 1, 0, 512, 0, 1, 3, 4 }, /* index 101 */
261 { 5, 1, 0, 132, 0, 1, 3, 4 }, /* index 102 */
262 { 5, 1, 0, 768, 0, 2, 3, 4 }, /* index 103 */
263 { 5, 1, 0, 528, 0, 1, 3, 4 }, /* index 104 */
264 { 5, 1, 0, 640, 9, 1, 1, 4 }, /* index 105 */
265 { 5, 1, 0, 792, 0, 1, 3, 4 }, /* index 106 */
266 { 5, 1, 0, 792, 0, 2, 3, 4 }, /* index 107 */
267 { 5, 1, 0, 682, 0, 1, 3, 4 }, /* index 108 */
268 { 5, 1, 0, 1023, 9, 1, 1, 4 }, /* index 109 */
269 { 6, 16, 1, 512, 0, 2, 2, 6 }, /* index 110 */
270 { 6, 8, 1, 512, 0, 2, 2, 6 }, /* index 111 */
271 { 6, 4, 1, 512, 0, 1, 2, 6 }, /* index 112 */
272 { 6, 2, 1, 528, 7, 1, 1, 6 }, /* index 113 */
273 { 6, 2, 1, 640, 7, 1, 1, 6 }, /* index 114 */
274 { 6, 2, 1, 640, 0, 1, 2, 6 }, /* index 115 */
275 { 6, 2, 1, 528, 0, 2, 2, 6 }, /* index 116 */
276 { 6, 2, 1, 768, 0, 2, 2, 6 }, /* index 117 */
277 { 6, 2, 1, 924, 0, 1, 2, 6 }, /* index 118 */
278 { 6, 1, 0, 4, 0, 1, 2, 6 }, /* index 119 */
279 { 6, 1, 0, 128, 0, 1, 2, 6 }, /* index 120 */
280 { 6, 2, 1, 512, 0, 1, 2, 6 }, /* index 121 */
281 { 6, 1, 0, 512, 0, 2, 2, 6 }, /* index 122 */
282 { 6, 1, 0, 512, 7, 1, 1, 6 }, /* index 123 */
283 { 6, 1, 0, 512, 0, 1, 2, 6 }, /* index 124 */
284 { 6, 1, 0, 132, 0, 1, 2, 6 }, /* index 125 */
285 { 6, 1, 0, 768, 0, 2, 2, 6 }, /* index 126 */
286 { 6, 1, 0, 528, 0, 1, 2, 6 }, /* index 127 */
287 { 6, 1, 0, 640, 7, 1, 1, 6 }, /* index 128 */
288 { 6, 1, 0, 792, 0, 1, 2, 6 }, /* index 129 */
289 { 6, 1, 0, 792, 0, 2, 2, 6 }, /* index 130 */
290 { 6, 1, 0, 682, 0, 1, 2, 6 }, /* index 131 */
291 { 6, 1, 0, 1023, 7, 1, 1, 6 }, /* index 132 */
292 { 7, 4, 1, 512, 2, 1, 6, 2 }, /* index 133 */
293 { 7, 2, 1, 512, 2, 1, 6, 2 }, /* index 134 */
294 { 7, 2, 1, 640, 2, 1, 6, 2 }, /* index 135 */
295 { 7, 2, 1, 528, 8, 1, 3, 2 }, /* index 136 */
296 { 7, 2, 1, 528, 2, 2, 6, 2 }, /* index 137 */
297 { 7, 1, 0, 512, 2, 2, 6, 2 }, /* index 138 */
298 { 7, 1, 0, 512, 8, 1, 3, 2 }, /* index 139 */
299 { 7, 1, 0, 512, 2, 1, 6, 2 }, /* index 140 */
300 { 7, 1, 0, 768, 2, 2, 6, 2 }, /* index 141 */
301 { 7, 1, 0, 528, 2, 1, 6, 2 }, /* index 142 */
302 { 7, 1, 0, 640, 8, 1, 3, 2 }, /* index 143 */
303 { 7, 1, 0, 682, 2, 1, 6, 2 }, /* index 144 */
304 { 8, 16, 1, 512, 0, 2, 1, 12 }, /* index 145 */
305 { 8, 8, 1, 512, 0, 2, 1, 12 }, /* index 146 */
306 { 8, 4, 1, 512, 2, 1, 1, 12 }, /* index 147 */
307 { 8, 2, 1, 512, 0, 1, 1, 12 }, /* index 148 */
308 { 8, 2, 1, 512, 2, 1, 1, 12 }, /* index 149 */
309 { 8, 2, 1, 640, 2, 1, 1, 12 }, /* index 150 */
310 { 8, 2, 1, 528, 2, 1, 1, 12 }, /* index 151 */
311 { 8, 2, 1, 528, 0, 2, 1, 12 }, /* index 152 */
312 { 8, 2, 1, 768, 0, 2, 1, 12 }, /* index 153 */
313 { 8, 2, 1, 924, 0, 1, 1, 12 }, /* index 154 */
314 { 8, 1, 0, 2, 0, 1, 1, 12 }, /* index 155 */
315 { 8, 1, 0, 4, 0, 1, 1, 12 }, /* index 156 */
316 { 8, 1, 0, 16, 0, 1, 1, 12 }, /* index 157 */
317 { 8, 1, 0, 128, 0, 1, 1, 12 }, /* index 158 */
318 { 8, 1, 0, 512, 0, 1, 1, 12 }, /* index 159 */
319 { 8, 1, 0, 512, 2, 1, 1, 12 }, /* index 160 */
320 { 8, 1, 0, 512, 0, 2, 1, 12 }, /* index 161 */
321 { 8, 1, 0, 528, 2, 1, 1, 12 }, /* index 162 */
322 { 8, 1, 0, 640, 2, 1, 1, 12 }, /* index 163 */
323 { 8, 1, 0, 768, 0, 2, 1, 12 }, /* index 164 */
324 { 8, 1, 0, 792, 2, 1, 1, 12 }, /* index 165 */
325 { 8, 1, 0, 682, 2, 1, 1, 12 }, /* index 166 */
326 { 8, 1, 0, 1023, 0, 2, 1, 12 }, /* index 167 */
327 { 8, 1, 0, 1023, 2, 1, 1, 12 }, /* index 168 */
328 { 9, 16, 1, 512, 2, 2, 6, 2 }, /* index 169 */
329 { 9, 8, 1, 512, 2, 2, 6, 2 }, /* index 170 */
330 { 9, 4, 1, 512, 2, 1, 6, 2 }, /* index 171 */
331 { 9, 2, 1, 512, 2, 1, 6, 2 }, /* index 172 */
332 { 9, 2, 1, 768, 2, 2, 6, 2 }, /* index 173 */
333 { 9, 2, 1, 640, 2, 1, 6, 2 }, /* index 174 */
334 { 9, 2, 1, 640, 8, 1, 3, 2 }, /* index 175 */
335 { 9, 2, 1, 528, 8, 1, 3, 2 }, /* index 176 */
336 { 9, 2, 1, 528, 2, 2, 6, 2 }, /* index 177 */
337 { 9, 2, 1, 924, 2, 1, 6, 2 }, /* index 178 */
338 { 9, 1, 0, 512, 2, 2, 6, 2 }, /* index 179 */
339 { 9, 1, 0, 512, 8, 1, 3, 2 }, /* index 180 */
340 { 9, 1, 0, 512, 2, 1, 6, 2 }, /* index 181 */
341 { 9, 1, 0, 768, 2, 2, 6, 2 }, /* index 182 */
342 { 9, 1, 0, 528, 2, 1, 6, 2 }, /* index 183 */
343 { 9, 1, 0, 640, 8, 1, 3, 2 }, /* index 184 */
344 { 9, 1, 0, 792, 2, 1, 6, 2 }, /* index 185 */
345 { 9, 1, 0, 792, 2, 2, 6, 2 }, /* index 186 */
346 { 9, 1, 0, 682, 2, 1, 6, 2 }, /* index 187 */
347 { 9, 1, 0, 1023, 8, 1, 3, 2 }, /* index 188 */
348 {10, 16, 1, 512, 2, 2, 2, 6 }, /* index 189 */
349 {10, 8, 1, 512, 2, 2, 2, 6 }, /* index 190 */
350 {10, 4, 1, 512, 2, 1, 2, 6 }, /* index 191 */
351 {10, 2, 1, 512, 2, 1, 2, 6 }, /* index 192 */
352 {10, 2, 1, 768, 2, 2, 2, 6 }, /* index 193 */
353 {10, 2, 1, 640, 2, 1, 2, 6 }, /* index 194 */
354 {10, 2, 1, 640, 8, 1, 1, 6 }, /* index 195 */
355 {10, 2, 1, 528, 8, 1, 1, 6 }, /* index 196 */
356 {10, 2, 1, 528, 2, 2, 2, 6 }, /* index 197 */
357 {10, 2, 1, 924, 2, 1, 2, 6 }, /* index 198 */
358 {10, 8, 1, 512, 8, 2, 1, 6 }, /* index 199 */
359 {10, 4, 1, 512, 8, 1, 1, 6 }, /* index 200 */
360 {10, 1, 0, 512, 2, 2, 2, 6 }, /* index 201 */
361 {10, 1, 0, 512, 8, 1, 1, 6 }, /* index 202 */
362 {10, 1, 0, 512, 2, 1, 2, 6 }, /* index 203 */
363 {10, 1, 0, 768, 2, 2, 2, 6 }, /* index 204 */
364 {10, 1, 0, 528, 2, 1, 2, 6 }, /* index 205 */
365 {10, 1, 0, 640, 8, 1, 1, 6 }, /* index 206 */
366 {10, 1, 0, 792, 2, 1, 2, 6 }, /* index 207 */
367 {10, 1, 0, 792, 2, 2, 2, 6 }, /* index 208 */
368 {10, 1, 0, 682, 2, 1, 2, 6 }, /* index 209 */
369 {10, 1, 0, 1023, 8, 1, 1, 6 }, /* index 210 */
370 {11, 2, 1, 512, 2, 1, 6, 2 }, /* index 211 */
371 {11, 2, 1, 528, 8, 1, 3, 2 }, /* index 212 */
372 {11, 2, 1, 640, 8, 1, 3, 2 }, /* index 213 */
373 {11, 2, 1, 640, 2, 1, 6, 2 }, /* index 214 */
374 {11, 2, 1, 528, 2, 2, 6, 2 }, /* index 215 */
375 {11, 2, 1, 768, 2, 2, 6, 2 }, /* index 216 */
376 {11, 1, 0, 512, 2, 2, 6, 2 }, /* index 217 */
377 {11, 1, 0, 512, 8, 1, 3, 2 }, /* index 218 */
378 {11, 1, 0, 512, 2, 1, 6, 2 }, /* index 219 */
379 {11, 1, 0, 768, 2, 2, 6, 2 }, /* index 220 */
380 {11, 1, 0, 528, 2, 1, 6, 2 }, /* index 221 */
381 {11, 1, 0, 640, 8, 1, 3, 2 }, /* index 222 */
382 {11, 1, 0, 792, 2, 2, 6, 2 }, /* index 223 */
383 {11, 1, 0, 682, 2, 1, 6, 2 }, /* index 224 */
384 {11, 1, 0, 1023, 8, 1, 3, 2 }, /* index 225 */
385 {12, 2, 1, 512, 0, 1, 3, 4 }, /* index 226 */
386 {12, 2, 1, 528, 6, 1, 2, 4 }, /* index 227 */
387 {12, 2, 1, 640, 6, 1, 2, 4 }, /* index 228 */
388 {12, 2, 1, 528, 0, 2, 3, 4 }, /* index 229 */
389 {12, 2, 1, 768, 0, 2, 3, 4 }, /* index 230 */
390 {12, 1, 0, 512, 0, 2, 3, 4 }, /* index 231 */
391 {12, 1, 0, 512, 6, 1, 2, 4 }, /* index 232 */
392 {12, 1, 0, 512, 0, 1, 3, 4 }, /* index 233 */
393 {12, 1, 0, 768, 0, 2, 3, 4 }, /* index 234 */
394 {12, 1, 0, 528, 0, 1, 3, 4 }, /* index 235 */
395 {12, 1, 0, 640, 6, 1, 2, 4 }, /* index 236 */
396 {12, 1, 0, 792, 0, 1, 3, 4 }, /* index 237 */
397 {12, 1, 0, 792, 0, 2, 3, 4 }, /* index 238 */
398 {12, 1, 0, 682, 0, 1, 3, 4 }, /* index 239 */
399 {12, 1, 0, 1023, 6, 1, 2, 4 }, /* index 240 */
400 {13, 2, 1, 512, 0, 1, 2, 6 }, /* index 241 */
401 {13, 2, 1, 528, 2, 1, 2, 6 }, /* index 242 */
402 {13, 2, 1, 640, 0, 1, 2, 6 }, /* index 243 */
403 {13, 2, 1, 640, 2, 1, 2, 6 }, /* index 244 */
404 {13, 2, 1, 528, 0, 2, 2, 6 }, /* index 245 */
405 {13, 2, 1, 768, 0, 2, 2, 6 }, /* index 246 */
406 {13, 1, 0, 512, 0, 2, 2, 6 }, /* index 247 */
407 {13, 1, 0, 512, 2, 1, 2, 6 }, /* index 248 */
408 {13, 1, 0, 512, 0, 1, 2, 6 }, /* index 249 */
409 {13, 1, 0, 768, 0, 2, 2, 6 }, /* index 250 */
410 {13, 1, 0, 528, 0, 1, 2, 6 }, /* index 251 */
411 {13, 1, 0, 640, 2, 1, 2, 6 }, /* index 252 */
412 {13, 1, 0, 792, 0, 2, 2, 6 }, /* index 253 */
413 {13, 1, 0, 682, 0, 1, 2, 6 }, /* index 254 */
414 {13, 1, 0, 1023, 2, 1, 2, 6 } /* index 255 */
418 /* prach config index Table 6.3.3.2-2 spec 38.211
419 * PRACH format given as follows:
434 * Subframe num is represented considering 0-9 bits and
435 * value 1 corresponds to the subframe that is valid
438 uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
439 { 0, 16, 1, 2, 0, 0, 0, 0 }, /* index 0 */
440 { 0, 16, 1, 16, 0, 0, 0, 0 }, /* index 1 */
441 { 0, 16, 1, 128, 0, 0, 0, 0 }, /* index 2 */
442 { 0, 16, 1, 512, 0, 0, 0, 0 }, /* index 3 */
443 { 0, 8, 1, 2, 0, 0, 0, 0 }, /* index 4 */
444 { 0, 8, 1, 16, 0, 0, 0, 0 }, /* index 5 */
445 { 0, 8, 1, 128, 0, 0, 0, 0 }, /* index 6 */
446 { 0, 8, 1, 512, 0, 0, 0, 0 }, /* index 7 */
447 { 0, 4, 1, 2, 0, 0, 0, 0 }, /* index 8 */
448 { 0, 4, 1, 16, 0, 0, 0, 0 }, /* index 9 */
449 { 0, 4, 1, 128, 0, 0, 0, 0 }, /* index 10 */
450 { 0, 4, 1, 512, 0, 0, 0, 0 }, /* index 11 */
451 { 0, 2, 1, 2, 0, 0, 0, 0 }, /* index 12 */
452 { 0, 2, 1, 16, 0, 0, 0, 0 }, /* index 13 */
453 { 0, 2, 1, 128, 0, 0, 0, 0 }, /* index 14 */
454 { 0, 2, 1, 512, 0, 0, 0, 0 }, /* index 15 */
455 { 0, 1, 0, 2, 0, 0, 0, 0 }, /* index 16 */
456 { 0, 1, 0, 16, 0, 0, 0, 0 }, /* index 17 */
457 { 0, 1, 0, 128, 0, 0, 0, 0 }, /* index 18 */
458 { 0, 1, 0, 66, 0, 0, 0, 0 }, /* index 19 */
459 { 0, 1, 0, 132, 0, 0, 0, 0 }, /* index 20 */
460 { 0, 1, 0, 264, 0, 0, 0, 0 }, /* index 21 */
461 { 0, 1, 0, 146, 0, 0, 0, 0 }, /* index 22 */
462 { 0, 1, 0, 292, 0, 0, 0, 0 }, /* index 23 */
463 { 0, 1, 0, 584, 0, 0, 0, 0 }, /* index 24 */
464 { 0, 1, 0, 341, 0, 0, 0, 0 }, /* index 25 */
465 { 0, 1, 0, 682, 0, 0, 0, 0 }, /* index 26 */
466 { 0, 1, 0, 1023, 0, 0, 0, 0 }, /* index 27 */
467 { 1, 16, 1, 2, 0, 0, 0, 0 }, /* index 28 */
468 { 1, 16, 1, 16, 0, 0, 0, 0 }, /* index 29 */
469 { 1, 16, 1, 128, 0, 0, 0, 0 }, /* index 30 */
470 { 1, 16, 1, 512, 0, 0, 0, 0 }, /* index 31 */
471 { 1, 8, 1, 2, 0, 0, 0, 0 }, /* index 32 */
472 { 1, 8, 1, 16, 0, 0, 0, 0 }, /* index 33 */
473 { 1, 8, 1, 128, 0, 0, 0, 0 }, /* index 34 */
474 { 1, 8, 1, 512, 0, 0, 0, 0 }, /* index 35 */
475 { 1, 4, 1, 2, 0, 0, 0, 0 }, /* index 36 */
476 { 1, 4, 1, 16, 0, 0, 0, 0 }, /* index 37 */
477 { 1, 4, 1, 128, 0, 0, 0, 0 }, /* index 38 */
478 { 1, 4, 1, 512, 0, 0, 0, 0 }, /* index 39 */
479 { 1, 2, 1, 2, 0, 0, 0, 0 }, /* index 40 */
480 { 1, 2, 1, 16, 0, 0, 0, 0 }, /* index 41 */
481 { 1, 2, 1, 128, 0, 0, 0, 0 }, /* index 42 */
482 { 1, 2, 1, 512, 0, 0, 0, 0 }, /* index 43 */
483 { 1, 1, 0, 2, 0, 0, 0, 0 }, /* index 44 */
484 { 1, 1, 0, 16, 0, 0, 0, 0 }, /* index 45 */
485 { 1, 1, 0, 128, 0, 0, 0, 0 }, /* index 46 */
486 { 1, 1, 0, 64, 0, 0, 0, 0 }, /* index 47 */
487 { 1, 1, 0, 132, 0, 0, 0, 0 }, /* index 48 */
488 { 1, 1, 0, 264, 0, 0, 0, 0 }, /* index 49 */
489 { 1, 1, 0, 146, 0, 0, 0, 0 }, /* index 50 */
490 { 1, 1, 0, 292, 0, 0, 0, 0 }, /* index 51 */
491 { 1, 1, 0, 584, 0, 0, 0, 0 }, /* index 52 */
492 { 2, 16, 1, 2, 0, 0, 0, 0 }, /* index 53 */
493 { 2, 8, 1, 2, 0, 0, 0, 0 }, /* index 54 */
494 { 2, 4, 0, 2, 0, 0, 0, 0 }, /* index 55 */
495 { 2, 2, 0, 2, 0, 0, 0, 0 }, /* index 56 */
496 { 2, 2, 0, 32, 0, 0, 0, 0 }, /* index 57 */
497 { 2, 1, 0, 2, 0, 0, 0, 0 }, /* index 58 */
498 { 2, 1, 0, 32, 0, 0, 0, 0 }, /* index 59 */
499 { 3, 16, 1, 2, 0, 0, 0, 0 }, /* index 60 */
500 { 3, 16, 1, 16, 0, 0, 0, 0 }, /* index 61 */
501 { 3, 16, 1, 128, 0, 0, 0, 0 }, /* index 62 */
502 { 3, 16, 1, 512, 0, 0, 0, 0 }, /* index 63 */
503 { 3, 8, 1, 2, 0, 0, 0, 0 }, /* index 64 */
504 { 3, 8, 1, 16, 0, 0, 0, 0 }, /* index 65 */
505 { 3, 8, 1, 128, 0, 0, 0, 0 }, /* index 66 */
506 { 3, 4, 1, 2, 0, 0, 0, 0 }, /* index 67 */
507 { 3, 4, 1, 16, 0, 0, 0, 0 }, /* index 68 */
508 { 3, 4, 1, 128, 0, 0, 0, 0 }, /* index 69 */
509 { 3, 4, 1, 512, 0, 0, 0, 0 }, /* index 70 */
510 { 3, 2, 1, 2, 0, 0, 0, 0 }, /* index 71 */
511 { 3, 2, 1, 16, 0, 0, 0, 0 }, /* index 72 */
512 { 3, 2, 1, 128, 0, 0, 0, 0 }, /* index 73 */
513 { 3, 2, 1, 512, 0, 0, 0, 0 }, /* index 74 */
514 { 3, 1, 0, 2, 0, 0, 0, 0 }, /* index 75 */
515 { 3, 1, 0, 16, 0, 0, 0, 0 }, /* index 76 */
516 { 3, 1, 0, 128, 0, 0, 0, 0 }, /* index 77 */
517 { 3, 1, 0, 66, 0, 0, 0, 0 }, /* index 78 */
518 { 3, 1, 0, 132, 0, 0, 0, 0 }, /* index 79 */
519 { 3, 1, 0, 264, 0, 0, 0, 0 }, /* index 80 */
520 { 3, 1, 0, 146, 0, 0, 0, 0 }, /* index 81 */
521 { 3, 1, 0, 292, 0, 0, 0, 0 }, /* index 82 */
522 { 3, 1, 0, 584, 0, 0, 0, 0 }, /* index 83 */
523 { 3, 1, 0, 341, 0, 0, 0, 0 }, /* index 84 */
524 { 3, 1, 0, 682, 0, 0, 0, 0 }, /* index 85 */
525 { 3, 1, 0, 1023, 0, 0, 0, 0 }, /* index 86 */
526 { 4, 16, 0, 528, 0, 1, 6, 2 }, /* index 87 */
527 { 4, 16, 1, 16, 0, 2, 6, 2 }, /* index 88 */
528 { 4, 8, 0, 528, 0, 1, 6, 2 }, /* index 89 */
529 { 4, 8, 1, 16, 0, 2, 6, 2 }, /* index 90 */
530 { 4, 4, 0, 528, 0, 1, 6, 2 }, /* index 91 */
531 { 4, 4, 1, 528, 0, 1, 6, 2 }, /* index 92 */
532 { 4, 4, 0, 16, 0, 2, 6, 2 }, /* index 93 */
533 { 4, 2, 0, 528, 0, 1, 6, 2 }, /* index 94 */
534 { 4, 2, 0, 2, 0, 2, 6, 2 }, /* index 95 */
535 { 4, 2, 0, 16, 0, 2, 6, 2 }, /* index 96 */
536 { 4, 2, 0, 128, 0, 2, 6, 2 }, /* index 97 */
537 { 4, 1, 0, 16, 0, 1, 6, 2 }, /* index 98 */
538 { 4, 1, 0, 66, 0, 1, 6, 2 }, /* index 99 */
539 { 4, 1, 0, 528, 0, 1, 6, 2 }, /* index 100 */
540 { 4, 1, 0, 2, 0, 2, 6, 2 }, /* index 101 */
541 { 4, 1, 0, 128, 0, 2, 6, 2 }, /* index 102 */
542 { 4, 1, 0, 132, 0, 2, 6, 2 }, /* index 103 */
543 { 4, 1, 0, 146, 0, 2, 6, 2 }, /* index 104 */
544 { 4, 1, 0, 341, 0, 2, 6, 2 }, /* index 105 */
545 { 4, 1, 0, 1023, 0, 2, 6, 2 }, /* index 106 */
546 { 4, 1, 0, 682, 0, 2, 6, 2 }, /* index 107 */
547 {11, 2, 0, 528, 0, 1, 7, 2 }, /* index 108 */
548 {11, 2, 0, 16, 0, 2, 7, 2 }, /* index 109 */
549 {11, 1, 0, 16, 0, 1, 7, 2 }, /* index 110 */
550 {11, 1, 0, 66, 0, 1, 7, 2 }, /* index 111 */
551 {11, 1, 0, 528, 0, 1, 7, 2 }, /* index 112 */
552 {11, 1, 0, 2, 0, 2, 7, 2 }, /* index 113 */
553 {11, 1, 0, 128, 0, 2, 7, 2 }, /* index 114 */
554 {11, 1, 0, 146, 0, 2, 7, 2 }, /* index 115 */
555 {11, 1, 0, 341, 0, 2, 7, 2 }, /* index 116 */
556 { 5, 16, 1, 580, 0, 1, 3, 4 }, /* index 117 */
557 { 5, 16, 1, 16, 0, 2, 3, 4 }, /* index 118 */
558 { 5, 8, 1, 580, 0, 1, 3, 4 }, /* index 119 */
559 { 5, 8, 1, 16, 0, 2, 3, 4 }, /* index 120 */
560 { 5, 4, 0, 580, 0, 1, 3, 4 }, /* index 121 */
561 { 5, 4, 0, 16, 0, 2, 3, 4 }, /* index 122 */
562 { 5, 2, 1, 580, 0, 1, 3, 4 }, /* index 123 */
563 { 5, 2, 0, 2, 0, 2, 3, 4 }, /* index 124 */
564 { 5, 2, 0, 16, 0, 2, 3, 4 }, /* index 125 */
565 { 5, 2, 0, 128, 0, 2, 3, 4 }, /* index 126 */
566 { 5, 1, 0, 16, 0, 1, 3, 4 }, /* index 127 */
567 { 5, 1, 0, 66, 0, 1, 3, 4 }, /* index 128 */
568 { 5, 1, 0, 528, 0, 1, 3, 4 }, /* index 129 */
569 { 5, 1, 0, 2, 0, 2, 3, 4 }, /* index 130 */
570 { 5, 1, 0, 128, 0, 2, 3, 4 }, /* index 131 */
571 { 5, 1, 0, 132, 0, 2, 3, 4 }, /* index 132 */
572 { 5, 1, 0, 146, 0, 2, 3, 4 }, /* index 133 */
573 { 5, 1, 0, 341, 0, 2, 3, 4 }, /* index 134 */
574 { 5, 1, 0, 1023, 0, 2, 3, 4 }, /* index 135 */
575 { 5, 1, 0, 682, 0, 2, 3, 4 }, /* index 136 */
576 {12, 2, 1, 580, 0, 1, 3, 4 }, /* index 137 */
577 {12, 2, 0, 16, 0, 2, 3, 4 }, /* index 138 */
578 {12, 1, 0, 16, 0, 1, 3, 4 }, /* index 139 */
579 {12, 1, 0, 66, 0, 1, 3, 4 }, /* index 140 */
580 {12, 1, 0, 528, 0, 1, 3, 4 }, /* index 141 */
581 {12, 1, 0, 2, 0, 2, 3, 4 }, /* index 142 */
582 {12, 1, 0, 128, 0, 2, 3, 4 }, /* index 143 */
583 {12, 1, 0, 146, 0, 2, 3, 4 }, /* index 144 */
584 {12, 1, 0, 341, 0, 2, 3, 4 }, /* index 145 */
585 {12, 1, 0, 1023, 0, 2, 3, 4 }, /* index 146 */
586 { 6, 16, 1, 528, 0, 1, 2, 6 }, /* index 147 */
587 { 6, 16, 1, 16, 0, 2, 2, 6 }, /* index 148 */
588 { 6, 8, 1, 528, 0, 1, 2, 6 }, /* index 149 */
589 { 6, 8, 1, 16, 0, 2, 2, 6 }, /* index 150 */
590 { 6, 4, 0, 528, 0, 1, 2, 6 }, /* index 151 */
591 { 6, 4, 0, 16, 0, 2, 2, 6 }, /* index 152 */
592 { 6, 2, 1, 580, 0, 2, 2, 6 }, /* index 153 */
593 { 6, 2, 0, 2, 0, 2, 2, 6 }, /* index 154 */
594 { 6, 2, 0, 16, 0, 2, 2, 6 }, /* index 155 */
595 { 6, 2, 0, 128, 0, 2, 2, 6 }, /* index 156 */
596 { 6, 1, 0, 16, 0, 1, 2, 6 }, /* index 157 */
597 { 6, 1, 0, 66, 0, 1, 2, 6 }, /* index 158 */
598 { 6, 1, 0, 528, 0, 1, 2, 6 }, /* index 159 */
599 { 6, 1, 0, 2, 0, 2, 2, 6 }, /* index 160 */
600 { 6, 1, 0, 128, 0, 2, 2, 6 }, /* index 161 */
601 { 6, 1, 0, 132, 0, 2, 2, 6 }, /* index 162 */
602 { 6, 1, 0, 146, 0, 2, 2, 6 }, /* index 163 */
603 { 6, 1, 0, 341, 0, 2, 2, 6 }, /* index 164 */
604 { 6, 1, 0, 1023, 0, 2, 2, 6 }, /* index 165 */
605 { 6, 1, 0, 682, 0, 2, 2, 6 }, /* index 166 */
606 {13, 2, 1, 580, 0, 2, 2, 6 }, /* index 167 */
607 {13, 2, 0, 16, 0, 2, 2, 6 }, /* index 168 */
608 {13, 1, 0, 16, 0, 1, 2, 6 }, /* index 169 */
609 {13, 1, 0, 66, 0, 1, 2, 6 }, /* index 170 */
610 {13, 1, 0, 528, 0, 1, 2, 6 }, /* index 171 */
611 {13, 1, 0, 2, 0, 2, 2, 6 }, /* index 172 */
612 {13, 1, 0, 128, 0, 2, 2, 6 }, /* index 173 */
613 {13, 1, 0, 146, 0, 2, 2, 6 }, /* index 174 */
614 {13, 1, 0, 341, 0, 2, 2, 6 }, /* index 175 */
615 {13, 1, 0, 1023, 0, 2, 2, 6 }, /* index 176 */
616 { 7, 16, 0, 528, 0, 1, 7, 2 }, /* index 177 */
617 { 7, 16, 1, 16, 0, 2, 7, 2 }, /* index 178 */
618 { 7, 8, 0, 528, 0, 1, 7, 2 }, /* index 179 */
619 { 7, 8, 1, 16, 0, 2, 7, 2 }, /* index 180 */
620 { 7, 4, 0, 528, 0, 1, 7, 2 }, /* index 181 */
621 { 7, 4, 1, 528, 0, 1, 7, 2 }, /* index 182 */
622 { 7, 4, 0, 16, 0, 2, 7, 2 }, /* index 183 */
623 { 7, 2, 0, 528, 0, 1, 7, 2 }, /* index 184 */
624 { 7, 2, 0, 2, 0, 2, 7, 2 }, /* index 185 */
625 { 7, 2, 0, 16, 0, 2, 7, 2 }, /* index 186 */
626 { 7, 2, 0, 128, 0, 2, 7, 2 }, /* index 187 */
627 { 7, 1, 0, 16, 0, 1, 7, 2 }, /* index 188 */
628 { 7, 1, 0, 66, 0, 1, 7, 2 }, /* index 189 */
629 { 7, 1, 0, 528, 0, 1, 7, 2 }, /* index 190 */
630 { 7, 1, 0, 2, 0, 2, 7, 2 }, /* index 191 */
631 { 7, 1, 0, 128, 0, 2, 7, 2 }, /* index 192 */
632 { 7, 1, 0, 132, 0, 2, 7, 2 }, /* index 193 */
633 { 7, 1, 0, 146, 0, 2, 7, 2 }, /* index 194 */
634 { 7, 1, 0, 341, 0, 2, 7, 2 }, /* index 195 */
635 { 7, 1, 0, 1023, 0, 2, 7, 2 }, /* index 196 */
636 { 7, 1, 0, 682, 0, 2, 7, 2 }, /* index 197 */
637 { 8, 16, 0, 528, 0, 2, 1, 12 }, /* index 198 */
638 { 8, 16, 1, 16, 0, 2, 1, 12 }, /* index 199 */
639 { 8, 8, 0, 528, 0, 2, 1, 12 }, /* index 200 */
640 { 8, 8, 1, 16, 0, 2, 1, 12 }, /* index 201 */
641 { 8, 4, 0, 528, 0, 2, 1, 12 }, /* index 202 */
642 { 8, 4, 0, 16, 0, 2, 1, 12 }, /* index 203 */
643 { 8, 4, 1, 528, 0, 2, 1, 12 }, /* index 204 */
644 { 8, 2, 0, 528, 0, 2, 1, 12 }, /* index 205 */
645 { 8, 2, 0, 2, 0, 2, 1, 12 }, /* index 206 */
646 { 8, 2, 0, 16, 0, 2, 1, 12 }, /* index 207 */
647 { 8, 2, 0, 128, 0, 2, 1, 12 }, /* index 208 */
648 { 8, 1, 0, 2, 0, 2, 1, 12 }, /* index 209 */
649 { 8, 1, 0, 16, 0, 2, 1, 12 }, /* index 210 */
650 { 8, 1, 0, 128, 0, 2, 1, 12 }, /* index 211 */
651 { 8, 1, 0, 66, 0, 2, 1, 12 }, /* index 212 */
652 { 8, 1, 0, 132, 0, 2, 1, 12 }, /* index 213 */
653 { 8, 1, 0, 528, 0, 2, 1, 12 }, /* index 214 */
654 { 8, 1, 0, 146, 0, 2, 1, 12 }, /* index 215 */
655 { 8, 1, 0, 341, 0, 2, 1, 12 }, /* index 216 */
656 { 8, 1, 0, 1023, 0, 2, 1, 12 }, /* index 217 */
657 { 8, 1, 0, 682, 0, 2, 1, 12 }, /* index 218 */
658 { 9, 8, 1, 16, 0, 2, 7, 2 }, /* index 219 */
659 { 9, 4, 1, 528, 0, 1, 7, 2 }, /* index 220 */
660 { 9, 4, 0, 16, 0, 2, 7, 2 }, /* index 221 */
661 { 9, 2, 0, 528, 0, 1, 7, 2 }, /* index 222 */
662 { 9, 2, 0, 2, 0, 2, 7, 2 }, /* index 223 */
663 { 9, 2, 0, 16, 0, 2, 7, 2 }, /* index 224 */
664 { 9, 2, 0, 128, 0, 2, 7, 2 }, /* index 225 */
665 { 9, 1, 0, 16, 0, 1, 7, 2 }, /* index 226 */
666 { 9, 1, 0, 66, 0, 1, 7, 2 }, /* index 227 */
667 { 9, 1, 0, 528, 0, 1, 7, 2 }, /* index 228 */
668 { 9, 1, 0, 2, 0, 2, 7, 2 }, /* index 229 */
669 { 9, 1, 0, 128, 0, 2, 7, 2 }, /* index 230 */
670 { 9, 1, 0, 132, 0, 2, 7, 2 }, /* index 231 */
671 { 9, 1, 0, 146, 0, 2, 7, 2 }, /* index 232 */
672 { 9, 1, 0, 341, 0, 2, 7, 2 }, /* index 233 */
673 { 9, 1, 0, 1023, 0, 2, 7, 2 }, /* index 234 */
674 { 9, 1, 0, 682, 0, 2, 7, 2 }, /* index 235 */
675 {10, 16, 1, 528, 0, 1, 2, 6 }, /* index 236 */
676 {10, 16, 1, 16, 0, 2, 2, 6 }, /* index 237 */
677 {10, 8, 1, 528, 0, 1, 2, 6 }, /* index 238 */
678 {10, 8, 1, 16, 0, 2, 2, 6 }, /* index 239 */
679 {10, 4, 0, 528, 0, 1, 2, 6 }, /* index 240 */
680 {10, 4, 0, 16, 0, 2, 2, 6 }, /* index 241 */
681 {10, 2, 1, 580, 0, 2, 2, 6 }, /* index 242 */
682 {10, 2, 0, 2, 0, 2, 2, 6 }, /* index 243 */
683 {10, 2, 0, 16, 0, 2, 2, 6 }, /* index 244 */
684 {10, 2, 0, 128, 0, 2, 2, 6 }, /* index 245 */
685 {10, 1, 0, 16, 0, 1, 2, 6 }, /* index 246 */
686 {10, 1, 0, 66, 0, 1, 2, 6 }, /* index 247 */
687 {10, 1, 0, 528, 0, 1, 2, 6 }, /* index 248 */
688 {10, 1, 0, 2, 0, 2, 2, 6 }, /* index 249 */
689 {10, 1, 0, 128, 0, 2, 2, 6 }, /* index 250 */
690 {10, 1, 0, 132, 0, 2, 2, 6 }, /* index 251 */
691 {10, 1, 0, 146, 0, 2, 2, 6 }, /* index 252 */
692 {10, 1, 0, 341, 0, 2, 2, 6 }, /* index 253 */
693 {10, 1, 0, 1023, 0, 2, 2, 6 }, /* index 254 */
694 {10, 1, 0, 682, 0, 2, 2, 6 } /* index 255 */
698 /* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */
699 uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 };
701 uint16_t tbSizeTable[TOTAL_TBSIZE_VALUES] = {
702 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, \
703 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, \
704 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
705 336, 352, 368, 384, 408, 432, 456, 480, 504, 528, \
706 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, \
707 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
708 1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, \
709 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, \
710 2600, 2664, 2728, 2792, 2856, 2976, 3104, 3240, 3368, 3496, \
713 uint16_t mcsTable[32][3] = {
714 { 0, 2, 120}, /* mcs index 0 */
715 { 1, 2, 157}, /* mcs index 1 */
716 { 2, 2, 193}, /* mcs index 2 */
717 { 3, 2, 251}, /* mcs index 3 */
718 { 4, 2, 308}, /* mcs index 4 */
719 { 5, 2, 379}, /* mcs index 5 */
720 { 6, 2, 449}, /* mcs index 6 */
721 { 7, 2, 526}, /* mcs index 7 */
722 { 8, 2, 602}, /* mcs index 8 */
723 { 9, 2, 679}, /* mcs index 9 */
724 { 10, 4, 340}, /* mcs index 10 */
725 { 11, 4, 378}, /* mcs index 11 */
726 { 12, 4, 434}, /* mcs index 12 */
727 { 13, 4, 490}, /* mcs index 13 */
728 { 14, 4, 553}, /* mcs index 14 */
729 { 15, 4, 616}, /* mcs index 15 */
730 { 16, 4, 658}, /* mcs index 16 */
731 { 17, 6, 438}, /* mcs index 17 */
732 { 18, 6, 466}, /* mcs index 18 */
733 { 19, 6, 517}, /* mcs index 19 */
734 { 20, 6, 567}, /* mcs index 20 */
735 { 21, 6, 616}, /* mcs index 21 */
736 { 22, 6, 666}, /* mcs index 22 */
737 { 23, 6, 719}, /* mcs index 23 */
738 { 24, 6, 772}, /* mcs index 24 */
739 { 25, 6, 822}, /* mcs index 25 */
740 { 26, 6, 873}, /* mcs index 26 */
741 { 27, 6, 910}, /* mcs index 27 */
742 { 28, 6, 948}, /* mcs index 28 */
743 { 29, 2, 0}, /* mcs index 29 */
744 { 30, 4, 0}, /* mcs index 30 */
745 { 31, 6, 0}}; /* mcs index 31 */
747 /* PUCCH resource sets before dedicated PUCCH resource configuration */
748 /* Table 9.2.1-1 spec 38.213 */
749 uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = {
750 { 0, 12, 2, 0 }, /* index 0 */
751 { 0, 12, 2, 0 }, /* index 1 */
752 { 0, 12, 2, 3 }, /* index 2 */
753 { 1, 10, 4, 0 }, /* index 3 */
754 { 1, 10, 4, 0 }, /* index 4 */
755 { 1, 10, 4, 2 }, /* index 5 */
756 { 1, 10, 4, 4 }, /* index 6 */
757 { 1, 4, 10, 0 }, /* index 7 */
758 { 1, 4, 10, 0 }, /* index 8 */
759 { 1, 4, 10, 2 }, /* index 9 */
760 { 1, 4, 10, 4 }, /* index 10 */
761 { 1, 0, 14, 0 }, /* index 11 */
762 { 1, 0, 14, 0 }, /* index 12 */
763 { 1, 0, 14, 2 }, /* index 13 */
764 { 1, 0, 14, 4 }, /* index 14 */
765 { 1, 0, 14, 0 }, /* index 15 */
768 /* Minimum Msg3 scheduling time should be calculated based on N1+N2+NTAmax+0.5
770 * Refer spec 38.213 section 8.3.
771 * Harcoding the minimum msg3 scheduling for now */
772 uint8_t minMsg3SchTime[MAX_NUM_MU] = {6, 6, 6, 6};
774 uint8_t defaultUlAckTbl[DEFAULT_UL_ACK_LIST_COUNT]= {1, 2, 3 , 4, 5, 6, 7, 8};
777 * @brief Function to find first DMRS symbol in PDSCH
781 * Function: findDmrsStartSymbol
783 * This function finds first DMRS symbol using DMRS symbol
786 * @param[in] DMRS symbol position bitmap
787 * @return Success : First DRMS symbol
788 * Failure : MAX_SYMB_PER_SLOT
790 uint8_t findDmrsStartSymbol(uint16_t dlDmrsSymbBitMap)
792 uint8_t position = 0;
795 while(position < MAX_SYMB_PER_SLOT)
797 if(dlDmrsSymbBitMap & mask)
806 * @brief Function to add a node to a linked list
810 * Function: addNodeToLList
812 * This function adds a new node to the linked list
814 * @param[in] Pointer to the list
815 * Pointer to node to be added
816 * Pointer to current node
820 uint8_t addNodeToLList(CmLListCp *llist, void *blockToAdd, CmLList *currNode)
824 SCH_ALLOC(newNode, sizeof(CmLList));
827 newNode->node = (PTR)blockToAdd;
829 if(currNode == NULLP)
830 cmLListAdd2Tail(llist, newNode);
833 llist->crnt = currNode;
834 cmLListInsAfterCrnt(llist, newNode);
842 * @brief Function to delete a node from linked list
846 * Function: deleteNodeFromLList
848 * This function deletes a node from the linked list
850 * @param[in] Pointer to the list
851 * Pointer to node to be deleted
852 * @return Pointer to the deleted node
854 uint8_t deleteNodeFromLList(CmLListCp *llist, CmLList *node)
856 node = cmLListDelFrm(llist, node);
857 SCH_FREE(node, sizeof(CmLList));
863 * @brief Checks if requested PRBs are free
867 * Function: isPrbAvailable
869 * This functions loops through all free PRB blocks and
870 * checks if request PRB block is available for allocation
872 * @param[in] List of free PRB blocks
873 * First PRB requested
874 * Total number of PRB requested
876 * @return Returns Pointer to free block
879 CmLList* isPrbAvailable(CmLListCp *freePrbBlockList, uint16_t startPrb, uint16_t numPrb)
882 CmLList *node = NULLP;
883 FreePrbBlock *freeBlock = NULLP;
885 endPrb = startPrb + numPrb - 1;
887 /* Iterate through all blocks of free PRB to check if requested PRBs can be assigned */
888 node = freePrbBlockList->first;
891 freeBlock = (FreePrbBlock *)node->node;
893 /* Check if requested number of blocks can be allocated from the current block */
894 if(freeBlock->numFreePrb < numPrb)
897 /* Check if requested PRBs belong within the range of current free block */
898 if(((startPrb >= freeBlock->startPrb) && (startPrb <= freeBlock->endPrb)) && \
899 ((endPrb >= freeBlock->startPrb) && (endPrb <= freeBlock->endPrb)))
904 /* If current block is unable to provide resources, check the next block */
911 * @brief Function to update free PRB list
915 * Function: removeAllocatedPrbFromFreePrbList
917 * This function removes the allocated PRBs from the
920 * @param[in] Pointer to the list
921 * Pointer to node from which PRB was allocated
922 * Start PRB allocated
923 * Number of PRBs allocated
926 void removeAllocatedPrbFromFreePrbList(CmLListCp *freePrbBlockList, CmLList *node, uint16_t startPrb, uint16_t numPrb)
929 FreePrbBlock *newBlock = NULLP;
930 FreePrbBlock *freeBlock = (FreePrbBlock *)node->node;
935 endPrb = startPrb + numPrb -1;
937 /* If the whole block is allocated, remove it from linked list */
938 if(freeBlock->numFreePrb == numPrb)
940 if(deleteNodeFromLList(freePrbBlockList, node) == ROK)
941 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
944 /* If PRB is allocated from start of free block, move the start of free block
945 * after last alloctaed PRB */
946 else if(freeBlock->startPrb == startPrb)
948 freeBlock->startPrb = endPrb+1;
949 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
952 /* If PRB is allocated from end of free block, move the end of free block
953 * before the first allocated PRB */
954 else if(freeBlock->endPrb == endPrb)
956 freeBlock->endPrb = startPrb-1;
957 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
960 /* If PRBs are allocated somewhere in between the free block, split it into 2
961 * nodes. Fist node contains free PRBs after the allocated PRBs. Second node
962 * contains free PRBs present before the allocated PRBs */
966 SCH_ALLOC(newBlock, sizeof(FreePrbBlock));
969 newBlock->startPrb = freeBlock->startPrb;
970 newBlock->endPrb = startPrb-1;
971 newBlock->numFreePrb = newBlock->endPrb - newBlock->startPrb +1;
972 addNodeToLList(freePrbBlockList, newBlock, node);
976 freeBlock->startPrb = endPrb+1;
977 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
982 * @brief frequency domain allocation function.
986 * Function: schCalcTbSize
988 * This function finds the TBSize from table Table 5.1.3.2-1 spec 38.214
990 * @param[in] payLoadSize - size of payload in bytes
991 * @return TBsize from the Table in bytes
993 uint16_t schCalcTbSize(uint32_t payLoadSize)
995 uint8_t tbsIndex = 0;
998 maxTbSize = tbSizeTable[TOTAL_TBSIZE_VALUES -1]/8;
999 if(payLoadSize >= maxTbSize)
1002 payLoadSize = payLoadSize*8;
1003 while(payLoadSize > tbSizeTable[tbsIndex])
1008 /* return the TBsize in bytes */
1009 return (tbSizeTable[tbsIndex]/8);
1013 * @brief frequency domain allocation function.
1017 * Function: schCalcNumPrb
1019 * This function calculates the number of PRbs
1021 * @param[in] tbSize in bytes
1023 * @param[in] number of symbols
1024 * @return number PRBs
1026 uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
1028 uint16_t numPrb = 0;
1030 uint16_t nreDash = 0;
1031 uint8_t qm = mcsTable[mcs][1];
1032 uint16_t rValue = mcsTable[mcs][2];
1033 uint8_t numLayer = 1; /* v value */
1034 uint8_t numDmrsRePerPrb = 12;
1036 tbSize = tbSize * 8; //Calculate tbSize in bits
1038 /* formula used for calculation of rbSize, 38.214 section 5.1.3.2 *
1039 * Ninfo = S . Nre . R . Qm . v *
1040 * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh *
1041 * Nre = min(156,Nre') . nPrb */
1043 nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer));
1045 nreDash = ceil( (12 * numSymbols) - numDmrsRePerPrb - 0);
1050 numPrb = ceil((float)nre / nreDash);
1055 * @brief calculation of transport block size.
1059 * Function: schCalcTbSizeFromNPrb
1061 * This function calculates the transport block size
1063 * @param[in] nPrb is num PRB
1065 * @param[in] number of symbols
1068 uint16_t schCalcTbSizeFromNPrb(uint16_t numPrb, uint16_t mcs, uint8_t numSymbols)
1070 uint8_t qm = mcsTable[mcs][1];
1071 uint16_t rValue = mcsTable[mcs][2];
1072 uint16_t tbsIndex = 0;
1073 uint32_t tbSize = 0;
1075 uint32_t nreDash = 0;
1078 uint32_t nInfoDash = 0;
1080 const uint8_t numLayer = 1;
1081 const uint16_t numRbSc = 12;
1082 const uint16_t numDmrsRes = 12;
1083 const uint16_t sf = 1;
1084 // uint16_t numPrbOvrHead = 0;
1086 /* formula used for calculation of rbSize, 38.214 section 5.1.3.2 *
1087 * Ninfo = Nre . R . Qm . v where [ NInfo is tbSize] *
1088 * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh *
1089 * Nre = min(156,Nre') . nPrb */
1091 nreDash = MIN(156, ceil( (numRbSc * numSymbols) - numDmrsRes - 0));
1092 nre = nreDash * numPrb;
1093 nInfo = ceil(nre * qm * numLayer * rValue/(1024.0 * sf));
1097 n = MAX(3, (uint32_t)cmLog2(nInfo) - 6);
1098 nInfoDash = MAX(24, (1<<n)*(nInfo/(1<<n)));
1099 while(nInfoDash > tbSizeTable[tbsIndex])
1103 tbSize = tbSizeTable[tbsIndex];
1107 n = (uint32_t)cmLog2(nInfo - 24) - 5;
1108 nInfoDash = MAX(3840, (1<<n)*ceil((nInfo - 24)/(1<<n)));
1112 c = ceil((nInfoDash + 24)/3816);
1113 tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
1117 if(nInfoDash > 8424)
1119 c = ceil((nInfoDash + 24)/8424);
1120 tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
1124 tbSize = 8 * ceil((nInfoDash + 24)/(8)) - 24;
1132 * @brief fetching ueCb from cellCb
1136 * Function: schGetUeCb
1138 * This function fetched UeCb based on crnti from cellCb
1144 SchUeCb* schGetUeCb(SchCellCb *cellCb, uint16_t crnti)
1147 GET_UE_ID(crnti, ueId);
1148 return &(cellCb->ueCb[ueId -1]);
1152 * @brief initialize UL slot info
1156 * Function: schInitUlSlot
1158 * This function intializes UL slot of the cell
1160 * @param[in] schUlSlotInfo
1163 void schInitUlSlot(SchUlSlotInfo *schUlSlotInfo)
1165 CmLList *node = NULLP, *next = NULLP;
1166 FreePrbBlock *freeBlock;
1168 /* Delete the old blocks */
1169 if(schUlSlotInfo->prbAlloc.freePrbBlockList.count)
1171 node = schUlSlotInfo->prbAlloc.freePrbBlockList.first;
1176 freeBlock = (FreePrbBlock *)node->node;
1177 if(deleteNodeFromLList(&schUlSlotInfo->prbAlloc.freePrbBlockList, node) == ROK)
1178 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
1182 /* Initilize UL Slot info and mark all PRBs as free */
1183 memset(schUlSlotInfo, 0, sizeof(SchUlSlotInfo));
1184 cmLListInit(&schUlSlotInfo->prbAlloc.freePrbBlockList);
1185 SCH_ALLOC(freeBlock, sizeof(FreePrbBlock));
1188 freeBlock->numFreePrb = MAX_NUM_RB;
1189 freeBlock->startPrb = 0;
1190 freeBlock->endPrb = MAX_NUM_RB-1;
1191 addNodeToLList(&schUlSlotInfo->prbAlloc.freePrbBlockList, freeBlock, NULL);
1194 schUlSlotInfo->puschCurrentPrb = PUSCH_START_RB;
1195 schUlSlotInfo->schPuschInfo = NULLP;
1199 * @brief initialize DL slot info
1203 * Function: schInitDlSlot
1205 * This function intializes DL slot of the cell
1207 * @param[in] schDlSlotInfo
1210 void schInitDlSlot(SchDlSlotInfo *schDlSlotInfo)
1212 CmLList *node = NULLP, *next = NULLP;
1213 FreePrbBlock *freeBlock;
1215 /* Delete the old blocks */
1216 if(schDlSlotInfo->prbAlloc.freePrbBlockList.count)
1217 node = schDlSlotInfo->prbAlloc.freePrbBlockList.first;
1221 freeBlock = (FreePrbBlock *)node->node;
1222 if(deleteNodeFromLList(&schDlSlotInfo->prbAlloc.freePrbBlockList, node) == ROK)
1223 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
1227 /* Initilize DL Slot info and mark all PRBs as free */
1228 memset(schDlSlotInfo, 0, sizeof(SchDlSlotInfo));
1229 cmLListInit(&schDlSlotInfo->prbAlloc.freePrbBlockList);
1230 SCH_ALLOC(freeBlock, sizeof(FreePrbBlock));
1233 freeBlock->numFreePrb = MAX_NUM_RB;
1234 freeBlock->startPrb = 0;
1235 freeBlock->endPrb = MAX_NUM_RB-1;
1236 addNodeToLList(&schDlSlotInfo->prbAlloc.freePrbBlockList, freeBlock, NULL);
1241 * @brief Fill resource bit map
1245 * Function: fillPrbBitmap
1247 * This function updates bitMap to mark the allocated PRBs
1249 * @param[in] schDlSlotInfo
1252 bool fillPrbBitmap(uint64_t *prbBitMap, uint16_t startPrb, uint16_t numPrb)
1254 uint16_t bitMapIdx = 0;
1255 uint16_t offsetInFirstIdx = 0;
1256 uint32_t numBitsToSetInFirstIdx = 0;
1257 uint64_t mask = MASK_BIT64_ON;
1258 uint64_t bitmapBackup[PRB_BITMAP_MAX_IDX];
1260 /* Store backup of the bitmap in order to roll back if PRB allocation fails */
1261 memcpy(bitmapBackup, prbBitMap, sizeof(bitmapBackup));
1263 /* Calculate the bitmap idx and offset of bit in that idx, to start
1264 * allocating PRBs from */
1265 bitMapIdx = startPrb / PRB_BITMAP_IDX_LEN;
1266 offsetInFirstIdx = startPrb % PRB_BITMAP_IDX_LEN;
1268 /* If number of PRBs allocated >= number of unset bits in first idx starting from offset bit
1269 * then set all bits in first idx starting from offset bit
1270 * else set bits equal to number of PRBs allocated
1272 numBitsToSetInFirstIdx = \
1273 (numPrb >= (PRB_BITMAP_IDX_LEN-offsetInFirstIdx)) ? (PRB_BITMAP_IDX_LEN-offsetInFirstIdx) : numPrb;
1275 mask = mask >> (PRB_BITMAP_IDX_LEN-numBitsToSetInFirstIdx);
1276 mask = mask<<offsetInFirstIdx;
1278 /* If PRBs to be allocated are not already in use, mark these PRBs as allocated */
1279 if(!(prbBitMap[bitMapIdx] & mask))
1281 prbBitMap[bitMapIdx] = prbBitMap[bitMapIdx] | mask;
1284 numPrb = numPrb - numBitsToSetInFirstIdx;
1285 /* Set all bits in a bitMapIdx until remaining numPrb is less than PRB_BITMAP_IDX_LEN */
1286 while(numPrb > PRB_BITMAP_IDX_LEN)
1288 if(prbBitMap[bitMapIdx])
1290 memcpy(prbBitMap, bitmapBackup, sizeof(bitmapBackup));
1293 prbBitMap[bitMapIdx] = MASK_BIT64_ON;
1295 numPrb = numPrb - PRB_BITMAP_IDX_LEN;
1298 /* Set bits for the remaining PRBs */
1301 mask = MASK_BIT64_ON;
1302 mask = mask >> (PRB_BITMAP_IDX_LEN-numPrb);
1303 if(!(prbBitMap[bitMapIdx] & mask))
1305 prbBitMap[bitMapIdx] = prbBitMap[bitMapIdx] | mask;
1309 memcpy(prbBitMap, bitmapBackup, sizeof(bitmapBackup));
1323 /**************************************************************************
1325 * @brief Update the LCID Node in LCLL as per ActionType
1329 * Function : handleLcLList
1332 * Search LCID in LCLL or if not found, create,Delete, or return
1333 * node for this LCID
1335 * @params[in] I/P > lcLinkList pointer (LcInfo list)
1337 * I/P > ActionType (Create,Delete or Just search)
1339 * @return lcNode > Pointer to the Node for that LcInfo
1340 * If NULLP, FATAL FAILURE
1342 * ***********************************************************************/
1343 LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLL action)
1345 CmLList *node = NULLP;
1346 LcInfo *lcNode = NULLP;
1351 DU_LOG("\nERROR --> SCH: LcList doesnt exist");
1356 /*Traversing the LC LinkList*/
1359 lcNode = (LcInfo *)node->node;
1360 if(lcNode->lcId == lcId)
1384 /*Need to add a new node for this LC*/
1386 /*List is empty; Initialize the LL ControlPointer*/
1387 if(lcLL->count == 0)
1393 /*Allocate the List*/
1394 SCH_ALLOC(lcNode, sizeof(LcInfo));
1397 lcNode->lcId = lcId;
1399 lcNode->allocBO = 0;
1400 lcNode->allocPRB = 0;
1404 DU_LOG("\nERROR --> SCH : Allocation of List failed,lcId:%d",lcId);
1408 if(addNodeToLList(lcLL, lcNode, NULLP) == RFAILED)
1410 DU_LOG("\nERROR --> SCH : failed to Add Node,lcId:%d",lcId);
1411 SCH_FREE(lcNode, sizeof(LcInfo));
1419 if(!found || lcNode == NULLP)
1421 DU_LOG("\nERROR --> SCH: LCID%d not found; thus Deletion unsuccessful",lcId);
1425 if(deleteNodeFromLList(lcLL, node) == ROK)
1426 SCH_FREE(lcNode, sizeof(LcInfo));
1428 DU_LOG("\nDEBUG --> SCH: LCID%d Deleted successfully",lcId);
1439 DU_LOG("\nERROR --> SCH: Action type wrong: %d",action);
1446 /**************************************************************************
1448 * @brief Update ReqPRB for a partiular LCID in LC Linklist
1452 * Function : updateLcListReqPRB
1455 * Update ReqPRB for a partiular LCID in LC Linklist
1457 * @params[in] I/P > lcLinkList pointer (LcInfo list)
1462 * @return ROK/RFAILED
1464 * ***********************************************************************/
1465 uint8_t updateLcListReqPRB(CmLListCp *lcLL, uint8_t lcId, uint32_t payloadSize)
1467 LcInfo *lcNode = NULLP;
1469 lcNode = handleLcLList(lcLL, lcId, CREATE);
1473 DU_LOG("\nERROR --> SCH : LC is neither present nor able to create in List lcId:%d",lcId);
1476 lcNode->reqBO = payloadSize;
1477 lcNode->allocBO = 0;
1478 lcNode->allocPRB = 0; /*Re-Initializing the AllocPRB*/
1482 /**************************************************************************
1484 * @brief Delete entire LC Linklist
1488 * Function : deleteLcLL
1491 * Delete entire LC Linklist
1493 * @params[in] lcLinkList pointer (LcInfo list)
1497 * ***********************************************************************/
1498 void deleteLcLL(CmLListCp *lcLL)
1500 CmLList *node = NULLP, *next = NULLP;
1501 LcInfo *lcNode = NULLP;
1505 DU_LOG("\nERROR --> SCH: LcList doesnt exist");
1513 lcNode = (LcInfo *)node->node;
1514 if(deleteNodeFromLList(lcLL, node) == ROK)
1515 SCH_FREE(lcNode, sizeof(LcInfo));
1520 /****************************************************************************
1522 * @brief Calculate the Estimated TBS Size based on Spec 38.421 , Sec 5.3.1.2
1526 * Function : calculateEstimateTBSize
1529 * TBS Size calculation requires numPRB. Since exactPRB for reqBO is unknown thus
1530 * will give the PRB value(from 0 to maxRB) one by one and
1531 * try to find the TBS size closest to reqBO
1533 * @params[in] I/P > reqBO, mcsIdx, num PDSCH symbols,
1534 * I/P > maxRB: Maximum PRB count to reach for calculating the TBS
1535 * O/P > estPrb : Suitable PRB count for reaching the correct TBS
1538 * @return TBS Size > Size which will can be allocated for this LC
1541 *************************************************************************/
1542 uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx,uint8_t numSymbols,\
1543 uint16_t maxPRB, uint16_t *estPrb)
1545 uint32_t tbs = 0, effecBO = 0;
1548 /*Loop Exit: Either estPRB reaches the maxRB or TBS is found greater than equal to reqBO*/
1551 tbs = schCalcTbSizeFromNPrb(*estPrb, mcsIdx, numSymbols);
1553 /*TBS size calculated in above function is in Bits.
1554 * So to convert it into Bytes , we right shift by 3.
1555 * Eg: tbs=128 bits(1000 0000) ; Right Shift by 3: Tbs = 0001 0000(16 bytes)*/
1558 }while((tbs < reqBO) && (*estPrb < maxPRB));
1560 /*Effective BO is the Grant which can be provided for this LC.
1561 * Here,it is decided based on whether we can fully cater its requirment (reqBO)
1562 * or has to provide lesser grant due to resource limitation.
1563 * Thus effective BO/Grant for this LC will be min of TBS calculated and reqBO*/
1564 effecBO = MIN(tbs,reqBO);
1567 /*Below function for printing will be used in future so disabling it for now*/
1569 /****************************************************************************
1571 * @brief Print the LC in list for debugging purpose
1575 * Function : printLcLL
1578 * For debugging purpose, for printing the LC in the order and
1581 * @params[in] LcList pointer
1585 *************************************************************************/
1586 void printLcLL(CmLListCp *lcLL)
1588 CmLList *node = NULLP;
1589 LcInfo *lcNode = NULLP;
1593 DU_LOG("\nINFO --> SCH: LcList doesnt exist");
1599 lcNode = (LcInfo *)node->node;
1602 DU_LOG("\nINFO --> SCH : LcID:%d, [reqBO, allocBO, allocPRB]:[%d,%d,%d]",\
1603 lcNode->lcId,lcNode->reqBO, lcNode->allocBO, lcNode->allocPRB);
1614 * @brief determines slot/symbol format
1618 * Function : schGetSlotSymbFrmt
1620 * This API is invoked to determine if current slot is DL or UL
1622 * @param[in] uint16_t slot
1623 * @param[in] uint32_t bitMap from cellCb
1624 * @return SlotConfig
1629 SlotConfig schGetSlotSymbFrmt(uint16_t slot, uint32_t bitMap)
1631 uint32_t offset = (slot)*2;
1632 return (bitMap & 0x3<<offset)>>offset;
1634 SlotConfig slotFrmt;
1635 int mask1 = 0, mask2 = 0;
1637 slot = (slot%n)*2;//n num of slots in defined periodicity or num of symbols
1639 mask2 = 1<<(slot+1);
1640 slotFrmt = ((mask1 & bitMap)>>slot) + (2*((mask2 & bitMap)>>(slot+1)));
1642 //printf("\n\n\n\n*****FormatType:%d Slot:%d****\n\n\n\n", slotFrmt, slot/2);
1649 * @brief Determine total length of configured slot pattern for specific
1650 * periodicity for TDD
1654 * Function : calculateSlotPatternLength
1656 * Determine total length of configured slot pattern for specific periodicity based
1657 * on slot duration for TDD
1659 * @param[in] uint8_t scs, uint8_t periodicity
1661 * @return uint8_t slotPatternLength
1664 uint8_t calculateSlotPatternLength(uint8_t scs, uint8_t periodicity)
1666 uint8_t slotPatternLength =0;
1667 float slotDuration = 0;
1669 /* Calculating the slot duration with the help of SCS.
1670 * This will provides the slot duration in ms like 1, 0.5, 0.25, 0.125.
1671 * If scs value is SCS_30KHZ its enum value is 1,
1672 * slotDuration = pow(0.5, 1);
1673 * slotDuration = 0.5 */
1675 slotDuration = pow(0.5,scs);
1677 /* Calculating length of pattern based on Transmission Periodicity.
1678 * If periodicity = TX_PRDCTY_MS_5,
1679 * slotPatternLength = 5/0.5
1680 * slotPatternLength = 10 i.e. {length of slot pattern DDDDDDDFUU}*/
1684 case TX_PRDCTY_MS_0P5:
1685 slotPatternLength = 0.5/slotDuration;
1687 case TX_PRDCTY_MS_0P625:
1688 slotPatternLength = 0.625/slotDuration;
1690 case TX_PRDCTY_MS_1:
1691 slotPatternLength = 1/slotDuration;
1693 case TX_PRDCTY_MS_1P25:
1694 slotPatternLength = 1.25/slotDuration;
1696 case TX_PRDCTY_MS_2:
1697 slotPatternLength = 2/slotDuration;
1699 case TX_PRDCTY_MS_2P5:
1700 slotPatternLength = 2.5/slotDuration;
1702 case TX_PRDCTY_MS_5:
1703 slotPatternLength = 5/slotDuration;
1705 case TX_PRDCTY_MS_10:
1706 slotPatternLength = 10/slotDuration;
1709 return slotPatternLength;
1715 * Frequency domain resources is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
1716 * [TS38.213 10.1]. Bitmap of uint8 array. 45 bits.
1719 * CORESET-freqdom.frequencyDomainResources : The bits of the bitmap have a one-to-one mapping with
1720 * non-overlapping groups of 6 RBs. The most significant bit of the first word corresponds to
1721 * the most significant bit defined in 38.331.
1723 * FAPI and IAPI both are 45 bits. Mapped from bit 0 LS Byte for the FAPI and
1724 * bit 0 LS U32 entry for IAPI.
1725 * FAPI is to be filled in following format such that Intel L1 is able to decode it :
1728 * FreqDomainResource[0] bits 7-0 -> nFreqDomain[0] bits 7-0
1729 * FreqDomainResource[1] bits 7-0 -> nFreqDomain[0] bits 15-8
1730 * FreqDomainResource[2] bits 7-0 -> nFreqDomain[0] bits 23-16
1731 * FreqDomainResource[3] bits 7-0 -> nFreqDomain[0] bits 31-24
1732 * FreqDomainResource[4] bits 7-0 -> nFreqDomain[1] bits 7-0
1733 * FreqDomainResource[5] bits 7-0 -> nFreqDomain[1] bits 15-8
1735 * where for the last entry bits 7,6 and 5 are don't care in the FAPI and bits
1736 * 31-13 are don't care in the IAPI.
1738 void covertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap)
1741 uint8_t numBitsToShift = 0;
1742 uint64_t freqDomainResources = 0;
1744 /* Bit operation to create a 64-bit integer that has
1745 * 48 LSBs [Bit 47 to Bit 0] mapped to sourceBitMap[0] to sourceBitMap[5]
1747 for(idx = FREQ_DOM_RSRC_SIZE-1; idx >=0; idx--)
1749 freqDomainResources |= ((uint64_t)sourceBitMap[idx] << numBitsToShift);
1750 numBitsToShift += 8;
1753 /* Right shift 3 bits because bits[2-0] are unused in sourceBitMap[5] */
1754 freqDomainResources = freqDomainResources >> 3;
1756 /* Filling destBitMap such that LSB bit 0 of freqDomainResources maps to LSB
1757 * of first word of destBitMap */
1759 for(idx=0; idx<FREQ_DOM_RSRC_SIZE; idx++)
1761 destBitMap[idx] = freqDomainResources >> numBitsToShift;
1762 numBitsToShift += 8;
1765 /**********************************************************************
1767 **********************************************************************/