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};
776 uint8_t schCmnDlRvTbl[4] = {0, 2, 3, 1};
778 * @brief Function to find first DMRS symbol in PDSCH
782 * Function: findDmrsStartSymbol
784 * This function finds first DMRS symbol using DMRS symbol
787 * @param[in] DMRS symbol position bitmap
788 * @return Success : First DRMS symbol
789 * Failure : MAX_SYMB_PER_SLOT
791 uint8_t findDmrsStartSymbol(uint16_t dlDmrsSymbBitMap)
793 uint8_t position = 0;
796 while(position < MAX_SYMB_PER_SLOT)
798 if(dlDmrsSymbBitMap & mask)
807 * @brief Function to add a node to a linked list
811 * Function: addNodeToLList
813 * This function adds a new node to the linked list
815 * @param[in] Pointer to the list
816 * Pointer to node to be added
817 * Pointer to current node
821 uint8_t addNodeToLList(CmLListCp *llist, void *blockToAdd, CmLList *currNode)
825 SCH_ALLOC(newNode, sizeof(CmLList));
828 newNode->node = (PTR)blockToAdd;
830 if(currNode == NULLP)
831 cmLListAdd2Tail(llist, newNode);
834 llist->crnt = currNode;
835 cmLListInsAfterCrnt(llist, newNode);
843 * @brief Function to delete a node from linked list
847 * Function: deleteNodeFromLList
849 * This function deletes a node from the linked list
851 * @param[in] Pointer to the list
852 * Pointer to node to be deleted
853 * @return Pointer to the deleted node
855 uint8_t deleteNodeFromLList(CmLListCp *llist, CmLList *node)
857 node = cmLListDelFrm(llist, node);
858 SCH_FREE(node, sizeof(CmLList));
864 * @brief Checks if requested PRBs are free
868 * Function: isPrbAvailable
870 * This functions loops through all free PRB blocks and
871 * checks if request PRB block is available for allocation
873 * @param[in] List of free PRB blocks
874 * First PRB requested
875 * Total number of PRB requested
877 * @return Returns Pointer to free block
880 CmLList* isPrbAvailable(CmLListCp *freePrbBlockList, uint16_t startPrb, uint16_t numPrb)
883 CmLList *node = NULLP;
884 FreePrbBlock *freeBlock = NULLP;
886 endPrb = startPrb + numPrb - 1;
888 /* Iterate through all blocks of free PRB to check if requested PRBs can be assigned */
889 node = freePrbBlockList->first;
892 freeBlock = (FreePrbBlock *)node->node;
894 /* Check if requested number of blocks can be allocated from the current block */
895 if(freeBlock->numFreePrb < numPrb)
898 /* Check if requested PRBs belong within the range of current free block */
899 if(((startPrb >= freeBlock->startPrb) && (startPrb <= freeBlock->endPrb)) && \
900 ((endPrb >= freeBlock->startPrb) && (endPrb <= freeBlock->endPrb)))
905 /* If current block is unable to provide resources, check the next block */
912 * @brief Function to update free PRB list
916 * Function: removeAllocatedPrbFromFreePrbList
918 * This function removes the allocated PRBs from the
921 * @param[in] Pointer to the list
922 * Pointer to node from which PRB was allocated
923 * Start PRB allocated
924 * Number of PRBs allocated
927 void removeAllocatedPrbFromFreePrbList(CmLListCp *freePrbBlockList, CmLList *node, uint16_t startPrb, uint16_t numPrb)
930 FreePrbBlock *newBlock = NULLP;
931 FreePrbBlock *freeBlock = (FreePrbBlock *)node->node;
936 endPrb = startPrb + numPrb -1;
938 /* If the whole block is allocated, remove it from linked list */
939 if(freeBlock->numFreePrb == numPrb)
941 if(deleteNodeFromLList(freePrbBlockList, node) == ROK)
942 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
945 /* If PRB is allocated from start of free block, move the start of free block
946 * after last alloctaed PRB */
947 else if(freeBlock->startPrb == startPrb)
949 freeBlock->startPrb = endPrb+1;
950 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
953 /* If PRB is allocated from end of free block, move the end of free block
954 * before the first allocated PRB */
955 else if(freeBlock->endPrb == endPrb)
957 freeBlock->endPrb = startPrb-1;
958 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
961 /* If PRBs are allocated somewhere in between the free block, split it into 2
962 * nodes. Fist node contains free PRBs after the allocated PRBs. Second node
963 * contains free PRBs present before the allocated PRBs */
967 SCH_ALLOC(newBlock, sizeof(FreePrbBlock));
970 newBlock->startPrb = freeBlock->startPrb;
971 newBlock->endPrb = startPrb-1;
972 newBlock->numFreePrb = newBlock->endPrb - newBlock->startPrb +1;
973 addNodeToLList(freePrbBlockList, newBlock, node);
977 freeBlock->startPrb = endPrb+1;
978 freeBlock->numFreePrb = freeBlock->endPrb - freeBlock->startPrb +1;
983 * @brief frequency domain allocation function.
987 * Function: schCalcTbSize
989 * This function finds the TBSize from table Table 5.1.3.2-1 spec 38.214
991 * @param[in] payLoadSize - size of payload in bytes
992 * @return TBsize from the Table in bytes
994 uint16_t schCalcTbSize(uint32_t payLoadSize)
996 uint8_t tbsIndex = 0;
999 maxTbSize = tbSizeTable[TOTAL_TBSIZE_VALUES -1]/8;
1000 if(payLoadSize >= maxTbSize)
1003 payLoadSize = payLoadSize*8;
1004 while(payLoadSize > tbSizeTable[tbsIndex])
1009 /* return the TBsize in bytes */
1010 return (tbSizeTable[tbsIndex]/8);
1014 * @brief frequency domain allocation function.
1018 * Function: schCalcNumPrb
1020 * This function calculates the number of PRbs
1022 * @param[in] tbSize in bytes
1024 * @param[in] number of symbols
1025 * @return number PRBs
1027 uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
1029 uint16_t numPrb = 0;
1031 uint16_t nreDash = 0;
1032 uint8_t qm = mcsTable[mcs][1];
1033 uint16_t rValue = mcsTable[mcs][2];
1034 uint8_t numLayer = 1; /* v value */
1035 uint8_t numDmrsRePerPrb = 12;
1037 tbSize = tbSize * 8; //Calculate tbSize in bits
1039 /* formula used for calculation of rbSize, 38.214 section 5.1.3.2 *
1040 * Ninfo = S . Nre . R . Qm . v *
1041 * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh *
1042 * Nre = min(156,Nre') . nPrb */
1044 nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer));
1046 nreDash = ceil( (12 * numSymbols) - numDmrsRePerPrb - 0);
1051 numPrb = ceil((float)nre / nreDash);
1056 * @brief calculation of transport block size.
1060 * Function: schCalcTbSizeFromNPrb
1062 * This function calculates the transport block size
1064 * @param[in] nPrb is num PRB
1066 * @param[in] number of symbols
1069 uint16_t schCalcTbSizeFromNPrb(uint16_t numPrb, uint16_t mcs, uint8_t numSymbols)
1071 uint8_t qm = mcsTable[mcs][1];
1072 uint16_t rValue = mcsTable[mcs][2];
1073 uint16_t tbsIndex = 0;
1074 uint32_t tbSize = 0;
1076 uint32_t nreDash = 0;
1079 uint32_t nInfoDash = 0;
1081 const uint8_t numLayer = 1;
1082 const uint16_t numRbSc = 12;
1083 const uint16_t numDmrsRes = 12;
1084 const uint16_t sf = 1;
1085 // uint16_t numPrbOvrHead = 0;
1087 /* formula used for calculation of rbSize, 38.214 section 5.1.3.2 *
1088 * Ninfo = Nre . R . Qm . v where [ NInfo is tbSize] *
1089 * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh *
1090 * Nre = min(156,Nre') . nPrb */
1092 nreDash = MIN(156, ceil( (numRbSc * numSymbols) - numDmrsRes - 0));
1093 nre = nreDash * numPrb;
1094 nInfo = ceil(nre * qm * numLayer * rValue/(1024.0 * sf));
1098 n = MAX(3, (uint32_t)cmLog2(nInfo) - 6);
1099 nInfoDash = MAX(24, (1<<n)*(nInfo/(1<<n)));
1100 while(nInfoDash > tbSizeTable[tbsIndex])
1104 tbSize = tbSizeTable[tbsIndex];
1108 n = (uint32_t)cmLog2(nInfo - 24) - 5;
1109 nInfoDash = MAX(3840, (1<<n)*ceil((nInfo - 24)/(1<<n)));
1113 c = ceil((nInfoDash + 24)/3816);
1114 tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
1118 if(nInfoDash > 8424)
1120 c = ceil((nInfoDash + 24)/8424);
1121 tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
1125 tbSize = 8 * ceil((nInfoDash + 24)/(8)) - 24;
1133 * @brief fetching ueCb from cellCb
1137 * Function: schGetUeCb
1139 * This function fetched UeCb based on crnti from cellCb
1145 SchUeCb* schGetUeCb(SchCellCb *cellCb, uint16_t crnti)
1148 GET_UE_ID(crnti, ueId);
1149 return &(cellCb->ueCb[ueId -1]);
1153 * @brief initialize UL slot info
1157 * Function: schInitUlSlot
1159 * This function intializes UL slot of the cell
1161 * @param[in] schUlSlotInfo
1164 void schInitUlSlot(SchUlSlotInfo *schUlSlotInfo)
1166 CmLList *node = NULLP, *next = NULLP;
1167 FreePrbBlock *freeBlock;
1169 /* Delete the old blocks */
1170 if(schUlSlotInfo->prbAlloc.freePrbBlockList.count)
1172 node = schUlSlotInfo->prbAlloc.freePrbBlockList.first;
1177 freeBlock = (FreePrbBlock *)node->node;
1178 if(deleteNodeFromLList(&schUlSlotInfo->prbAlloc.freePrbBlockList, node) == ROK)
1179 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
1183 /* Initilize UL Slot info and mark all PRBs as free */
1184 memset(schUlSlotInfo, 0, sizeof(SchUlSlotInfo));
1185 cmLListInit(&schUlSlotInfo->prbAlloc.freePrbBlockList);
1186 SCH_ALLOC(freeBlock, sizeof(FreePrbBlock));
1189 freeBlock->numFreePrb = MAX_NUM_RB;
1190 freeBlock->startPrb = 0;
1191 freeBlock->endPrb = MAX_NUM_RB-1;
1192 addNodeToLList(&schUlSlotInfo->prbAlloc.freePrbBlockList, freeBlock, NULL);
1195 schUlSlotInfo->puschCurrentPrb = PUSCH_START_RB;
1196 schUlSlotInfo->schPuschInfo = NULLP;
1200 * @brief initialize DL slot info
1204 * Function: schInitDlSlot
1206 * This function intializes DL slot of the cell
1208 * @param[in] schDlSlotInfo
1211 void schInitDlSlot(SchDlSlotInfo *schDlSlotInfo)
1213 CmLList *node = NULLP, *next = NULLP;
1214 FreePrbBlock *freeBlock;
1216 /* Delete the old blocks */
1217 if(schDlSlotInfo->prbAlloc.freePrbBlockList.count)
1218 node = schDlSlotInfo->prbAlloc.freePrbBlockList.first;
1222 freeBlock = (FreePrbBlock *)node->node;
1223 if(deleteNodeFromLList(&schDlSlotInfo->prbAlloc.freePrbBlockList, node) == ROK)
1224 SCH_FREE(freeBlock, sizeof(FreePrbBlock));
1228 /* Initilize DL Slot info and mark all PRBs as free */
1229 memset(schDlSlotInfo, 0, sizeof(SchDlSlotInfo));
1230 cmLListInit(&schDlSlotInfo->prbAlloc.freePrbBlockList);
1231 SCH_ALLOC(freeBlock, sizeof(FreePrbBlock));
1234 freeBlock->numFreePrb = MAX_NUM_RB;
1235 freeBlock->startPrb = 0;
1236 freeBlock->endPrb = MAX_NUM_RB-1;
1237 addNodeToLList(&schDlSlotInfo->prbAlloc.freePrbBlockList, freeBlock, NULL);
1242 * @brief Fill resource bit map
1246 * Function: fillPrbBitmap
1248 * This function updates bitMap to mark the allocated PRBs
1250 * @param[in] schDlSlotInfo
1253 bool fillPrbBitmap(uint64_t *prbBitMap, uint16_t startPrb, uint16_t numPrb)
1255 uint16_t bitMapIdx = 0;
1256 uint16_t offsetInFirstIdx = 0;
1257 uint32_t numBitsToSetInFirstIdx = 0;
1258 uint64_t mask = MASK_BIT64_ON;
1259 uint64_t bitmapBackup[PRB_BITMAP_MAX_IDX];
1261 /* Store backup of the bitmap in order to roll back if PRB allocation fails */
1262 memcpy(bitmapBackup, prbBitMap, sizeof(bitmapBackup));
1264 /* Calculate the bitmap idx and offset of bit in that idx, to start
1265 * allocating PRBs from */
1266 bitMapIdx = startPrb / PRB_BITMAP_IDX_LEN;
1267 offsetInFirstIdx = startPrb % PRB_BITMAP_IDX_LEN;
1269 /* If number of PRBs allocated >= number of unset bits in first idx starting from offset bit
1270 * then set all bits in first idx starting from offset bit
1271 * else set bits equal to number of PRBs allocated
1273 numBitsToSetInFirstIdx = \
1274 (numPrb >= (PRB_BITMAP_IDX_LEN-offsetInFirstIdx)) ? (PRB_BITMAP_IDX_LEN-offsetInFirstIdx) : numPrb;
1276 mask = mask >> (PRB_BITMAP_IDX_LEN-numBitsToSetInFirstIdx);
1277 mask = mask<<offsetInFirstIdx;
1279 /* If PRBs to be allocated are not already in use, mark these PRBs as allocated */
1280 if(!(prbBitMap[bitMapIdx] & mask))
1282 prbBitMap[bitMapIdx] = prbBitMap[bitMapIdx] | mask;
1285 numPrb = numPrb - numBitsToSetInFirstIdx;
1286 /* Set all bits in a bitMapIdx until remaining numPrb is less than PRB_BITMAP_IDX_LEN */
1287 while(numPrb > PRB_BITMAP_IDX_LEN)
1289 if(prbBitMap[bitMapIdx])
1291 memcpy(prbBitMap, bitmapBackup, sizeof(bitmapBackup));
1294 prbBitMap[bitMapIdx] = MASK_BIT64_ON;
1296 numPrb = numPrb - PRB_BITMAP_IDX_LEN;
1299 /* Set bits for the remaining PRBs */
1302 mask = MASK_BIT64_ON;
1303 mask = mask >> (PRB_BITMAP_IDX_LEN-numPrb);
1304 if(!(prbBitMap[bitMapIdx] & mask))
1306 prbBitMap[bitMapIdx] = prbBitMap[bitMapIdx] | mask;
1310 memcpy(prbBitMap, bitmapBackup, sizeof(bitmapBackup));
1324 /**************************************************************************
1326 * @brief Update the LCID Node in LCLL as per ActionType
1330 * Function : handleLcLList
1333 * Search LCID in LCLL or if not found, create,Delete, or return
1334 * node for this LCID
1336 * @params[in] I/P > lcLinkList pointer (LcInfo list)
1338 * I/P > ActionType (Create,Delete or Just search)
1340 * @return lcNode > Pointer to the Node for that LcInfo
1341 * If NULLP, FATAL FAILURE
1343 * ***********************************************************************/
1344 LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLL action)
1346 CmLList *node = NULLP;
1347 LcInfo *lcNode = NULLP;
1352 DU_LOG("\nERROR --> SCH: LcList doesnt exist");
1357 /*Traversing the LC LinkList*/
1360 lcNode = (LcInfo *)node->node;
1361 if(lcNode->lcId == lcId)
1385 /*Need to add a new node for this LC*/
1387 /*List is empty; Initialize the LL ControlPointer*/
1388 if(lcLL->count == 0)
1394 /*Allocate the List*/
1395 SCH_ALLOC(lcNode, sizeof(LcInfo));
1398 lcNode->lcId = lcId;
1400 lcNode->allocBO = 0;
1401 lcNode->allocPRB = 0;
1405 DU_LOG("\nERROR --> SCH : Allocation of List failed,lcId:%d",lcId);
1409 if(addNodeToLList(lcLL, lcNode, NULLP) == RFAILED)
1411 DU_LOG("\nERROR --> SCH : failed to Add Node,lcId:%d",lcId);
1412 SCH_FREE(lcNode, sizeof(LcInfo));
1420 if(!found || lcNode == NULLP)
1422 DU_LOG("\nERROR --> SCH: LCID%d not found; thus Deletion unsuccessful",lcId);
1426 if(deleteNodeFromLList(lcLL, node) == ROK)
1427 SCH_FREE(lcNode, sizeof(LcInfo));
1429 DU_LOG("\nDEBUG --> SCH: LCID%d Deleted successfully",lcId);
1440 DU_LOG("\nERROR --> SCH: Action type wrong: %d",action);
1447 /**************************************************************************
1449 * @brief Update ReqPRB for a partiular LCID in LC Linklist
1453 * Function : updateLcListReqPRB
1456 * Update ReqPRB for a partiular LCID in LC Linklist
1458 * @params[in] I/P > lcLinkList pointer (LcInfo list)
1463 * @return ROK/RFAILED
1465 * ***********************************************************************/
1466 uint8_t updateLcListReqPRB(CmLListCp *lcLL, uint8_t lcId, uint32_t payloadSize)
1468 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);
1477 lcNode->reqBO = payloadSize;
1478 lcNode->allocBO = 0;
1479 lcNode->allocPRB = 0; /*Re-Initializing the AllocPRB*/
1483 /**************************************************************************
1485 * @brief Delete entire LC Linklist
1489 * Function : deleteLcLL
1492 * Delete entire LC Linklist
1494 * @params[in] lcLinkList pointer (LcInfo list)
1498 * ***********************************************************************/
1499 void deleteLcLL(CmLListCp *lcLL)
1501 CmLList *node = NULLP, *next = NULLP;
1502 LcInfo *lcNode = NULLP;
1506 DU_LOG("\nERROR --> SCH: LcList doesnt exist");
1514 lcNode = (LcInfo *)node->node;
1515 if(deleteNodeFromLList(lcLL, node) == ROK)
1516 SCH_FREE(lcNode, sizeof(LcInfo));
1521 /****************************************************************************
1523 * @brief Calculate the Estimated TBS Size based on Spec 38.421 , Sec 5.3.1.2
1527 * Function : calculateEstimateTBSize
1530 * TBS Size calculation requires numPRB. Since exactPRB for reqBO is unknown thus
1531 * will give the PRB value(from 0 to maxRB) one by one and
1532 * try to find the TBS size closest to reqBO
1534 * @params[in] I/P > reqBO, mcsIdx, num PDSCH symbols,
1535 * I/P > maxRB: Maximum PRB count to reach for calculating the TBS
1536 * O/P > estPrb : Suitable PRB count for reaching the correct TBS
1539 * @return TBS Size > Size which will can be allocated for this LC
1542 *************************************************************************/
1543 uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx, uint8_t numSymbols,\
1544 uint16_t maxPRB, uint16_t *estPrb)
1546 uint32_t tbs = 0, effecBO = 0;
1549 /*Loop Exit: Either estPRB reaches the maxRB or TBS is found greater than equal to reqBO*/
1552 tbs = schCalcTbSizeFromNPrb(*estPrb, mcsIdx, numSymbols);
1554 /*TBS size calculated in above function is in Bits.
1555 * So to convert it into Bytes , we right shift by 3.
1556 * Eg: tbs=128 bits(1000 0000) ; Right Shift by 3: Tbs = 0001 0000(16 bytes)*/
1559 }while((tbs < reqBO) && (*estPrb < maxPRB));
1561 /*Effective BO is the Grant which can be provided for this LC.
1562 * Here,it is decided based on whether we can fully cater its requirment (reqBO)
1563 * or has to provide lesser grant due to resource limitation.
1564 * Thus effective BO/Grant for this LC will be min of TBS calculated and reqBO*/
1565 effecBO = MIN(tbs,reqBO);
1570 /*******************************************************************
1572 * @brief deleting Page Info node from PageInfo List
1576 * Function : schDeleteFromPageInfoList
1578 * Functionality: deleting page Info node from Page Info List
1580 * @params[in] CmLListCp *list, CmLList *node
1584 * ****************************************************************/
1585 void schDeleteFromPageInfoList(CmLListCp *list, CmLList *node)
1587 SchPageInfo *pageInfo;
1591 pageInfo = (SchPageInfo *)node->node;
1592 if(deleteNodeFromLList(list, node) == ROK)
1593 SCH_FREE(pageInfo, sizeof(SchPageInfo));
1597 /*******************************************************************
1599 * @brief searching for Page at a particular SFN
1603 * Function : schPageInfoSearchFromPageList
1605 * Functionality: searching for Page at a particular SFN
1607 * @params[in] SlotTimingInfo slotInfo, CmLListCp *storedPageList
1609 * @return pointer to SchPageInfo
1611 * ****************************************************************/
1612 CmLList *schPageInfoSearchFromPageList(SlotTimingInfo slotInfo, CmLListCp *storedPageList)
1614 CmLList *node = NULLP;
1615 SchPageInfo *pageInfo = NULLP;
1617 if(storedPageList->count)
1619 CM_LLIST_FIRST_NODE(storedPageList, node);
1622 pageInfo = (SchPageInfo*)node->node;
1623 if(pageInfo == NULLP)
1625 DU_LOG("\nERROR --> SCH: PageInfo empty");
1627 else if(pageInfo->pageTxTime.sfn == slotInfo.sfn &&
1628 (pageInfo->pageTxTime.slot == slotInfo.slot))
1638 /*Below function for printing will be used in future so disabling it for now*/
1640 /****************************************************************************
1642 * @brief Print the LC in list for debugging purpose
1646 * Function : printLcLL
1649 * For debugging purpose, for printing the LC in the order and
1652 * @params[in] LcList pointer
1656 *************************************************************************/
1657 void printLcLL(CmLListCp *lcLL)
1659 CmLList *node = NULLP;
1660 LcInfo *lcNode = NULLP;
1664 DU_LOG("\nINFO --> SCH: LcList doesnt exist");
1670 lcNode = (LcInfo *)node->node;
1673 DU_LOG("\nINFO --> SCH : LcID:%d, [reqBO, allocBO, allocPRB]:[%d,%d,%d]",\
1674 lcNode->lcId,lcNode->reqBO, lcNode->allocBO, lcNode->allocPRB);
1685 * @brief determines slot/symbol format
1689 * Function : schGetSlotSymbFrmt
1691 * This API is invoked to determine if current slot is DL or UL
1693 * @param[in] uint16_t slot
1694 * @param[in] uint32_t bitMap from cellCb
1695 * @return SlotConfig
1700 SlotConfig schGetSlotSymbFrmt(uint16_t slot, uint32_t bitMap)
1702 uint32_t offset = (slot)*2;
1703 return (bitMap & 0x3<<offset)>>offset;
1705 SlotConfig slotFrmt;
1706 int mask1 = 0, mask2 = 0;
1708 slot = (slot%n)*2;//n num of slots in defined periodicity or num of symbols
1710 mask2 = 1<<(slot+1);
1711 slotFrmt = ((mask1 & bitMap)>>slot) + (2*((mask2 & bitMap)>>(slot+1)));
1713 //printf("\n\n\n\n*****FormatType:%d Slot:%d****\n\n\n\n", slotFrmt, slot/2);
1720 * @brief Determine total length of configured slot pattern for specific
1721 * periodicity for TDD
1725 * Function : calculateSlotPatternLength
1727 * Determine total length of configured slot pattern for specific periodicity based
1728 * on slot duration for TDD
1730 * @param[in] uint8_t scs, uint8_t periodicity
1732 * @return uint8_t slotPatternLength
1735 uint8_t calculateSlotPatternLength(uint8_t scs, uint8_t periodicity)
1737 uint8_t slotPatternLength =0;
1738 float slotDuration = 0;
1740 /* Calculating the slot duration with the help of SCS.
1741 * This will provides the slot duration in ms like 1, 0.5, 0.25, 0.125.
1742 * If scs value is SCS_30KHZ its enum value is 1,
1743 * slotDuration = pow(0.5, 1);
1744 * slotDuration = 0.5 */
1746 slotDuration = pow(0.5,scs);
1748 /* Calculating length of pattern based on Transmission Periodicity.
1749 * If periodicity = TX_PRDCTY_MS_5,
1750 * slotPatternLength = 5/0.5
1751 * slotPatternLength = 10 i.e. {length of slot pattern DDDDDDDFUU}*/
1755 case TX_PRDCTY_MS_0P5:
1756 slotPatternLength = 0.5/slotDuration;
1758 case TX_PRDCTY_MS_0P625:
1759 slotPatternLength = 0.625/slotDuration;
1761 case TX_PRDCTY_MS_1:
1762 slotPatternLength = 1/slotDuration;
1764 case TX_PRDCTY_MS_1P25:
1765 slotPatternLength = 1.25/slotDuration;
1767 case TX_PRDCTY_MS_2:
1768 slotPatternLength = 2/slotDuration;
1770 case TX_PRDCTY_MS_2P5:
1771 slotPatternLength = 2.5/slotDuration;
1773 case TX_PRDCTY_MS_5:
1774 slotPatternLength = 5/slotDuration;
1776 case TX_PRDCTY_MS_10:
1777 slotPatternLength = 10/slotDuration;
1780 return slotPatternLength;
1786 * Frequency domain resources is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
1787 * [TS38.213 10.1]. Bitmap of uint8 array. 45 bits.
1790 * CORESET-freqdom.frequencyDomainResources : The bits of the bitmap have a one-to-one mapping with
1791 * non-overlapping groups of 6 RBs. The most significant bit of the first word corresponds to
1792 * the most significant bit defined in 38.331.
1794 * FAPI and IAPI both are 45 bits. Mapped from bit 0 LS Byte for the FAPI and
1795 * bit 0 LS U32 entry for IAPI.
1796 * FAPI is to be filled in following format such that Intel L1 is able to decode it :
1799 * FreqDomainResource[0] bits 7-0 -> nFreqDomain[0] bits 7-0
1800 * FreqDomainResource[1] bits 7-0 -> nFreqDomain[0] bits 15-8
1801 * FreqDomainResource[2] bits 7-0 -> nFreqDomain[0] bits 23-16
1802 * FreqDomainResource[3] bits 7-0 -> nFreqDomain[0] bits 31-24
1803 * FreqDomainResource[4] bits 7-0 -> nFreqDomain[1] bits 7-0
1804 * FreqDomainResource[5] bits 7-0 -> nFreqDomain[1] bits 15-8
1806 * where for the last entry bits 7,6 and 5 are don't care in the FAPI and bits
1807 * 31-13 are don't care in the IAPI.
1809 void covertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap)
1812 uint8_t numBitsToShift = 0;
1813 uint64_t freqDomainResources = 0;
1815 /* Bit operation to create a 64-bit integer that has
1816 * 48 LSBs [Bit 47 to Bit 0] mapped to sourceBitMap[0] to sourceBitMap[5]
1818 for(idx = FREQ_DOM_RSRC_SIZE-1; idx >=0; idx--)
1820 freqDomainResources |= ((uint64_t)sourceBitMap[idx] << numBitsToShift);
1821 numBitsToShift += 8;
1824 /* Right shift 3 bits because bits[2-0] are unused in sourceBitMap[5] */
1825 freqDomainResources = freqDomainResources >> 3;
1827 /* Filling destBitMap such that LSB bit 0 of freqDomainResources maps to LSB
1828 * of first word of destBitMap */
1830 for(idx=0; idx<FREQ_DOM_RSRC_SIZE; idx++)
1832 destBitMap[idx] = freqDomainResources >> numBitsToShift;
1833 numBitsToShift += 8;
1836 /**********************************************************************
1838 **********************************************************************/