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 "sch_utils.h"
39 /* spec-38.213 Table 13-1 */
40 int8_t coresetIdxTable[MAX_CORESET_INDEX][4] = {
41 { 1, 24, 2, 0}, /* index 0 */
42 { 1, 24, 2, 2}, /* index 1 */
43 { 1, 24, 2, 4}, /* index 2 */
44 { 1, 24, 3, 0}, /* index 3 */
45 { 1, 24, 3, 2}, /* index 4 */
46 { 1, 24, 3, 4}, /* index 5 */
47 { 1, 48, 1, 12}, /* index 6 */
48 { 1, 48, 1, 16}, /* index 7 */
49 { 1, 48, 2, 12}, /* index 8 */
50 { 1, 48, 2, 16}, /* index 9 */
51 { 1, 48, 3, 12}, /* index 10 */
52 { 1, 48, 3, 16}, /* index 11 */
53 { 1, 96, 1, 38}, /* index 12 */
54 { 1, 96, 2, 38}, /* index 13 */
55 { 1, 96, 3, 38}, /* index 14 */
56 { 0, 0, 0, 0}, /* index 15 */
59 /* spec-38.213 Table 13-11 */
60 /* m value is scaled to 2, when using it in formula, divide by 2 */
61 /* firstSymbol will vary depends on i, hence not filled */
62 int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4] = {
63 { 0, 1, 2, 0}, /* index 0 */
64 { 0, 2, 1, 0}, /* index 1 */
65 { 2, 1, 2, 0}, /* index 2 */
66 { 2, 2, 1, 0}, /* index 3 */
67 { 5, 1, 2, 0}, /* index 4 */
68 { 5, 2, 1, 0}, /* index 5 */
69 { 7, 1, 2, 0}, /* index 6 */
70 { 7, 2, 1, 0}, /* index 7 */
71 { 0, 1, 4, 0}, /* index 8 */
72 { 5, 1, 4, 0}, /* index 9 */
73 { 0, 1, 2, 0}, /* index 10 */
74 { 0, 1, 2, 0}, /* index 11 */
75 { 2, 1, 2, 0}, /* index 12 */
76 { 2, 1, 2, 0}, /* index 13 */
77 { 5, 1, 2, 0}, /* index 14 */
78 { 5, 1, 2, 0}, /* index 15 */
83 /* spec-38.211 Table 6.3.3.2-1 */
84 /* Lra, delFRa, delF, numRb, k' */
85 uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5] = {
86 { 839, 1.25, 15, 6, 7 }, /* index 0 */
87 { 839, 1.25, 30, 3, 1 }, /* index 1 */
88 { 839, 1.25, 60, 2, 133 }, /* index 2 */
89 { 839, 5, 15, 24, 12 }, /* index 3 */
90 { 839, 5, 30, 12, 10 }, /* index 4 */
91 { 839, 5, 60, 6, 7 }, /* index 5 */
92 { 139, 15, 15, 12, 2 }, /* index 6 */
93 { 139, 15, 30, 6, 2 }, /* index 7 */
94 { 139, 15, 60, 3, 2 }, /* index 8 */
95 { 139, 30, 15, 24, 2 }, /* index 9 */
96 { 139, 30, 30, 12, 2 }, /* index 10 */
97 { 139, 30, 60, 6, 2 }, /* index 11 */
98 { 139, 60, 60, 12, 2 }, /* index 12 */
99 { 139, 60, 120, 6, 2 }, /* index 13 */
100 { 139, 120, 60, 24, 2 }, /* index 14 */
101 { 139, 120, 120, 12, 2 }, /* index 15 */
104 /* prach config index Table 6.3.3.2-2 spec 38.211
105 * PRACH format given as follows:
120 * Subframe num is represented considering 0-9 bits and
121 * value 1 corresponds to the subframe that is valid
124 uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
125 { 0, 16, 1, 2, 0, 0, 0, 0 }, /* index 0 */
126 { 0, 16, 1, 16, 0, 0, 0, 0 }, /* index 1 */
127 { 0, 16, 1, 128, 0, 0, 0, 0 }, /* index 2 */
128 { 0, 16, 1, 512, 0, 0, 0, 0 }, /* index 3 */
129 { 0, 8, 1, 2, 0, 0, 0, 0 }, /* index 4 */
130 { 0, 8, 1, 16, 0, 0, 0, 0 }, /* index 5 */
131 { 0, 8, 1, 128, 0, 0, 0, 0 }, /* index 6 */
132 { 0, 8, 1, 512, 0, 0, 0, 0 }, /* index 7 */
133 { 0, 4, 1, 2, 0, 0, 0, 0 }, /* index 8 */
134 { 0, 4, 1, 16, 0, 0, 0, 0 }, /* index 9 */
135 { 0, 4, 1, 128, 0, 0, 0, 0 }, /* index 10 */
136 { 0, 4, 1, 512, 0, 0, 0, 0 }, /* index 11 */
137 { 0, 2, 1, 2, 0, 0, 0, 0 }, /* index 12 */
138 { 0, 2, 1, 16, 0, 0, 0, 0 }, /* index 13 */
139 { 0, 2, 1, 128, 0, 0, 0, 0 }, /* index 14 */
140 { 0, 2, 1, 512, 0, 0, 0, 0 }, /* index 15 */
141 { 0, 1, 0, 2, 0, 0, 0, 0 }, /* index 16 */
142 { 0, 1, 0, 16, 0, 0, 0, 0 }, /* index 17 */
143 { 0, 1, 0, 128, 0, 0, 0, 0 }, /* index 18 */
144 { 0, 1, 0, 66, 0, 0, 0, 0 }, /* index 19 */
145 { 0, 1, 0, 132, 0, 0, 0, 0 }, /* index 20 */
146 { 0, 1, 0, 264, 0, 0, 0, 0 }, /* index 21 */
147 { 0, 1, 0, 146, 0, 0, 0, 0 }, /* index 22 */
148 { 0, 1, 0, 292, 0, 0, 0, 0 }, /* index 23 */
149 { 0, 1, 0, 584, 0, 0, 0, 0 }, /* index 24 */
150 { 0, 1, 0, 341, 0, 0, 0, 0 }, /* index 25 */
151 { 0, 1, 0, 682, 0, 0, 0, 0 }, /* index 26 */
152 { 0, 1, 0, 1023, 0, 0, 0, 0 }, /* index 27 */
153 { 1, 16, 1, 2, 0, 0, 0, 0 }, /* index 28 */
154 { 1, 16, 1, 16, 0, 0, 0, 0 }, /* index 29 */
155 { 1, 16, 1, 128, 0, 0, 0, 0 }, /* index 30 */
156 { 1, 16, 1, 512, 0, 0, 0, 0 }, /* index 31 */
157 { 1, 8, 1, 2, 0, 0, 0, 0 }, /* index 32 */
158 { 1, 8, 1, 16, 0, 0, 0, 0 }, /* index 33 */
159 { 1, 8, 1, 128, 0, 0, 0, 0 }, /* index 34 */
160 { 1, 8, 1, 512, 0, 0, 0, 0 }, /* index 35 */
161 { 1, 4, 1, 2, 0, 0, 0, 0 }, /* index 36 */
162 { 1, 4, 1, 16, 0, 0, 0, 0 }, /* index 37 */
163 { 1, 4, 1, 128, 0, 0, 0, 0 }, /* index 38 */
164 { 1, 4, 1, 512, 0, 0, 0, 0 }, /* index 39 */
165 { 1, 2, 1, 2, 0, 0, 0, 0 }, /* index 40 */
166 { 1, 2, 1, 16, 0, 0, 0, 0 }, /* index 41 */
167 { 1, 2, 1, 128, 0, 0, 0, 0 }, /* index 42 */
168 { 1, 2, 1, 512, 0, 0, 0, 0 }, /* index 43 */
169 { 1, 1, 0, 2, 0, 0, 0, 0 }, /* index 44 */
170 { 1, 1, 0, 16, 0, 0, 0, 0 }, /* index 45 */
171 { 1, 1, 0, 128, 0, 0, 0, 0 }, /* index 46 */
172 { 1, 1, 0, 64, 0, 0, 0, 0 }, /* index 47 */
173 { 1, 1, 0, 132, 0, 0, 0, 0 }, /* index 48 */
174 { 1, 1, 0, 264, 0, 0, 0, 0 }, /* index 49 */
175 { 1, 1, 0, 146, 0, 0, 0, 0 }, /* index 50 */
176 { 1, 1, 0, 292, 0, 0, 0, 0 }, /* index 51 */
177 { 1, 1, 0, 584, 0, 0, 0, 0 }, /* index 52 */
178 { 2, 16, 1, 2, 0, 0, 0, 0 }, /* index 53 */
179 { 2, 8, 1, 2, 0, 0, 0, 0 }, /* index 54 */
180 { 2, 4, 0, 2, 0, 0, 0, 0 }, /* index 55 */
181 { 2, 2, 0, 2, 0, 0, 0, 0 }, /* index 56 */
182 { 2, 2, 0, 32, 0, 0, 0, 0 }, /* index 57 */
183 { 2, 1, 0, 2, 0, 0, 0, 0 }, /* index 58 */
184 { 2, 1, 0, 32, 0, 0, 0, 0 }, /* index 59 */
185 { 3, 16, 1, 2, 0, 0, 0, 0 }, /* index 60 */
186 { 3, 16, 1, 16, 0, 0, 0, 0 }, /* index 61 */
187 { 3, 16, 1, 128, 0, 0, 0, 0 }, /* index 62 */
188 { 3, 16, 1, 512, 0, 0, 0, 0 }, /* index 63 */
189 { 3, 8, 1, 2, 0, 0, 0, 0 }, /* index 64 */
190 { 3, 8, 1, 16, 0, 0, 0, 0 }, /* index 65 */
191 { 3, 8, 1, 128, 0, 0, 0, 0 }, /* index 66 */
192 { 3, 4, 1, 2, 0, 0, 0, 0 }, /* index 67 */
193 { 3, 4, 1, 16, 0, 0, 0, 0 }, /* index 68 */
194 { 3, 4, 1, 128, 0, 0, 0, 0 }, /* index 69 */
195 { 3, 4, 1, 512, 0, 0, 0, 0 }, /* index 70 */
196 { 3, 2, 1, 2, 0, 0, 0, 0 }, /* index 71 */
197 { 3, 2, 1, 16, 0, 0, 0, 0 }, /* index 72 */
198 { 3, 2, 1, 128, 0, 0, 0, 0 }, /* index 73 */
199 { 3, 2, 1, 512, 0, 0, 0, 0 }, /* index 74 */
200 { 3, 1, 0, 2, 0, 0, 0, 0 }, /* index 75 */
201 { 3, 1, 0, 16, 0, 0, 0, 0 }, /* index 76 */
202 { 3, 1, 0, 128, 0, 0, 0, 0 }, /* index 77 */
203 { 3, 1, 0, 66, 0, 0, 0, 0 }, /* index 78 */
204 { 3, 1, 0, 132, 0, 0, 0, 0 }, /* index 79 */
205 { 3, 1, 0, 264, 0, 0, 0, 0 }, /* index 80 */
206 { 3, 1, 0, 146, 0, 0, 0, 0 }, /* index 81 */
207 { 3, 1, 0, 292, 0, 0, 0, 0 }, /* index 82 */
208 { 3, 1, 0, 584, 0, 0, 0, 0 }, /* index 83 */
209 { 3, 1, 0, 341, 0, 0, 0, 0 }, /* index 84 */
210 { 3, 1, 0, 682, 0, 0, 0, 0 }, /* index 85 */
211 { 3, 1, 0, 1023, 0, 0, 0, 0 }, /* index 86 */
212 { 4, 16, 0, 528, 0, 1, 6, 2 }, /* index 87 */
213 { 4, 16, 1, 16, 0, 2, 6, 2 }, /* index 88 */
214 { 4, 8, 0, 528, 0, 1, 6, 2 }, /* index 89 */
215 { 4, 8, 1, 16, 0, 2, 6, 2 }, /* index 90 */
216 { 4, 4, 0, 528, 0, 1, 6, 2 }, /* index 91 */
217 { 4, 4, 1, 528, 0, 1, 6, 2 }, /* index 92 */
218 { 4, 4, 0, 16, 0, 2, 6, 2 }, /* index 93 */
219 { 4, 2, 0, 528, 0, 1, 6, 2 }, /* index 94 */
220 { 4, 2, 0, 2, 0, 2, 6, 2 }, /* index 95 */
221 { 4, 2, 0, 16, 0, 2, 6, 2 }, /* index 96 */
222 { 4, 2, 0, 128, 0, 2, 6, 2 }, /* index 97 */
223 { 4, 1, 0, 16, 0, 1, 6, 2 }, /* index 98 */
224 { 4, 1, 0, 66, 0, 1, 6, 2 }, /* index 99 */
225 { 4, 1, 0, 528, 0, 1, 6, 2 }, /* index 100 */
226 { 4, 1, 0, 2, 0, 2, 6, 2 }, /* index 101 */
227 { 4, 1, 0, 128, 0, 2, 6, 2 }, /* index 102 */
228 { 4, 1, 0, 132, 0, 2, 6, 2 }, /* index 103 */
229 { 4, 1, 0, 146, 0, 2, 6, 2 }, /* index 104 */
230 { 4, 1, 0, 341, 0, 2, 6, 2 }, /* index 105 */
231 { 4, 1, 0, 1023, 0, 2, 6, 2 }, /* index 106 */
232 { 4, 1, 0, 682, 0, 2, 6, 2 }, /* index 107 */
233 {11, 2, 0, 528, 0, 1, 7, 2 }, /* index 108 */
234 {11, 2, 0, 16, 0, 2, 7, 2 }, /* index 109 */
235 {11, 1, 0, 16, 0, 1, 7, 2 }, /* index 110 */
236 {11, 1, 0, 66, 0, 1, 7, 2 }, /* index 111 */
237 {11, 1, 0, 528, 0, 1, 7, 2 }, /* index 112 */
238 {11, 1, 0, 2, 0, 2, 7, 2 }, /* index 113 */
239 {11, 1, 0, 128, 0, 2, 7, 2 }, /* index 114 */
240 {11, 1, 0, 146, 0, 2, 7, 2 }, /* index 115 */
241 {11, 1, 0, 341, 0, 2, 7, 2 }, /* index 116 */
242 { 5, 16, 1, 580, 0, 1, 3, 4 }, /* index 117 */
243 { 5, 16, 1, 16, 0, 2, 3, 4 }, /* index 118 */
244 { 5, 8, 1, 580, 0, 1, 3, 4 }, /* index 119 */
245 { 5, 8, 1, 16, 0, 2, 3, 4 }, /* index 120 */
246 { 5, 4, 0, 580, 0, 1, 3, 4 }, /* index 121 */
247 { 5, 4, 0, 16, 0, 2, 3, 4 }, /* index 122 */
248 { 5, 2, 1, 580, 0, 1, 3, 4 }, /* index 123 */
249 { 5, 2, 0, 2, 0, 2, 3, 4 }, /* index 124 */
250 { 5, 2, 0, 16, 0, 2, 3, 4 }, /* index 125 */
251 { 5, 2, 0, 128, 0, 2, 3, 4 }, /* index 126 */
252 { 5, 1, 0, 16, 0, 1, 3, 4 }, /* index 127 */
253 { 5, 1, 0, 66, 0, 1, 3, 4 }, /* index 128 */
254 { 5, 1, 0, 528, 0, 1, 3, 4 }, /* index 129 */
255 { 5, 1, 0, 2, 0, 2, 3, 4 }, /* index 130 */
256 { 5, 1, 0, 128, 0, 2, 3, 4 }, /* index 131 */
257 { 5, 1, 0, 132, 0, 2, 3, 4 }, /* index 132 */
258 { 5, 1, 0, 146, 0, 2, 3, 4 }, /* index 133 */
259 { 5, 1, 0, 341, 0, 2, 3, 4 }, /* index 134 */
260 { 5, 1, 0, 1023, 0, 2, 3, 4 }, /* index 135 */
261 { 5, 1, 0, 682, 0, 2, 3, 4 }, /* index 136 */
262 {12, 2, 1, 580, 0, 1, 3, 4 }, /* index 137 */
263 {12, 2, 2, 16, 0, 1, 3, 4 }, /* index 138 */
264 {12, 2, 1, 16, 0, 1, 3, 4 }, /* index 139 */
265 {12, 2, 1, 66, 0, 1, 3, 4 }, /* index 140 */
266 {12, 2, 1, 528, 0, 1, 3, 4 }, /* index 141 */
267 {12, 2, 1, 2, 0, 1, 3, 4 }, /* index 142 */
268 {12, 2, 1, 128, 0, 1, 3, 4 }, /* index 143 */
269 {12, 2, 1, 146, 0, 1, 3, 4 }, /* index 144 */
270 {12, 2, 1, 341, 0, 1, 3, 4 }, /* index 145 */
271 {12, 2, 1, 1023, 0, 1, 3, 4 }, /* index 146 */
272 { 6, 16, 1, 528, 0, 1, 2, 6 }, /* index 147 */
273 { 6, 16, 1, 16, 0, 2, 2, 6 }, /* index 148 */
274 { 6, 8, 1, 528, 0, 1, 2, 6 }, /* index 149 */
275 { 6, 8, 1, 16, 0, 2, 2, 6 }, /* index 150 */
276 { 6, 4, 0, 528, 0, 1, 2, 6 }, /* index 151 */
277 { 6, 4, 0, 16, 0, 2, 2, 6 }, /* index 152 */
278 { 6, 2, 1, 580, 0, 2, 2, 6 }, /* index 153 */
279 { 6, 2, 0, 2, 0, 2, 2, 6 }, /* index 154 */
280 { 6, 2, 0, 16, 0, 2, 2, 6 }, /* index 155 */
281 { 6, 2, 0, 128, 0, 2, 2, 6 }, /* index 156 */
282 { 6, 1, 0, 16, 0, 1, 2, 6 }, /* index 157 */
283 { 6, 1, 0, 66, 0, 1, 2, 6 }, /* index 158 */
284 { 6, 1, 0, 528, 0, 1, 2, 6 }, /* index 159 */
285 { 6, 1, 0, 2, 0, 2, 2, 6 }, /* index 160 */
286 { 6, 1, 0, 128, 0, 2, 2, 6 }, /* index 161 */
287 { 6, 1, 0, 132, 0, 2, 2, 6 }, /* index 162 */
288 { 6, 1, 0, 146, 0, 2, 2, 6 }, /* index 163 */
289 { 6, 1, 0, 341, 0, 2, 2, 6 }, /* index 164 */
290 { 6, 1, 0, 1023, 0, 2, 2, 6 }, /* index 165 */
291 { 6, 1, 0, 682, 0, 2, 2, 6 }, /* index 166 */
292 {13, 2, 1, 580, 0, 2, 2, 6 }, /* index 167 */
293 {13, 2, 2, 16, 0, 2, 2, 6 }, /* index 168 */
294 {13, 2, 1, 16, 0, 1, 2, 6 }, /* index 169 */
295 {13, 2, 1, 66, 0, 1, 2, 6 }, /* index 170 */
296 {13, 2, 1, 528, 0, 1, 2, 6 }, /* index 171 */
297 {13, 2, 1, 2, 0, 2, 2, 6 }, /* index 172 */
298 {13, 2, 1, 128, 0, 2, 2, 6 }, /* index 173 */
299 {13, 2, 1, 146, 0, 2, 2, 6 }, /* index 174 */
300 {13, 2, 1, 341, 0, 2, 2, 6 }, /* index 175 */
301 {13, 2, 1, 1023, 0, 2, 2, 6 }, /* index 176 */
302 { 7, 16, 0, 528, 0, 1, 7, 2 }, /* index 177 */
303 { 7, 16, 1, 16, 0, 2, 7, 2 }, /* index 178 */
304 { 7, 8, 0, 528, 0, 1, 7, 2 }, /* index 179 */
305 { 7, 8, 1, 16, 0, 2, 7, 2 }, /* index 180 */
306 { 7, 4, 0, 528, 0, 1, 7, 2 }, /* index 181 */
307 { 7, 4, 1, 528, 0, 1, 7, 2 }, /* index 182 */
308 { 7, 4, 0, 16, 0, 2, 7, 2 }, /* index 183 */
309 { 7, 2, 0, 528, 0, 1, 7, 2 }, /* index 184 */
310 { 7, 2, 0, 2, 0, 2, 7, 2 }, /* index 185 */
311 { 7, 2, 0, 16, 0, 2, 7, 2 }, /* index 186 */
312 { 7, 2, 0, 128, 0, 2, 7, 2 }, /* index 187 */
313 { 7, 1, 0, 16, 0, 1, 7, 2 }, /* index 188 */
314 { 7, 1, 0, 66, 0, 1, 7, 2 }, /* index 189 */
315 { 7, 1, 0, 528, 0, 1, 7, 2 }, /* index 190 */
316 { 7, 1, 0, 2, 0, 2, 7, 2 }, /* index 191 */
317 { 7, 1, 0, 128, 0, 2, 7, 2 }, /* index 192 */
318 { 7, 1, 0, 132, 0, 2, 7, 2 }, /* index 193 */
319 { 7, 1, 0, 146, 0, 2, 7, 2 }, /* index 194 */
320 { 7, 1, 0, 341, 0, 2, 7, 2 }, /* index 195 */
321 { 7, 1, 0, 1023, 0, 2, 7, 2 }, /* index 196 */
322 { 7, 1, 0, 682, 0, 2, 7, 2 }, /* index 197 */
323 { 8, 16, 0, 528, 0, 2, 1, 12 }, /* index 198 */
324 { 8, 16, 1, 16, 0, 2, 1, 12 }, /* index 199 */
325 { 8, 8, 0, 528, 0, 2, 1, 12 }, /* index 200 */
326 { 8, 8, 1, 16, 0, 2, 1, 12 }, /* index 201 */
327 { 8, 4, 0, 528, 0, 2, 1, 12 }, /* index 202 */
328 { 8, 4, 0, 16, 0, 2, 1, 12 }, /* index 203 */
329 { 8, 4, 1, 528, 0, 2, 1, 12 }, /* index 204 */
330 { 8, 2, 0, 528, 0, 2, 1, 12 }, /* index 205 */
331 { 8, 2, 0, 2, 0, 2, 1, 12 }, /* index 206 */
332 { 8, 2, 0, 16, 0, 2, 1, 12 }, /* index 207 */
333 { 8, 2, 0, 128, 0, 2, 1, 12 }, /* index 208 */
334 { 8, 1, 0, 2, 0, 2, 1, 12 }, /* index 209 */
335 { 8, 1, 0, 16, 0, 2, 1, 12 }, /* index 210 */
336 { 8, 1, 0, 128, 0, 2, 1, 12 }, /* index 211 */
337 { 8, 1, 0, 66, 0, 2, 1, 12 }, /* index 212 */
338 { 8, 1, 0, 132, 0, 2, 1, 12 }, /* index 213 */
339 { 8, 1, 0, 528, 0, 2, 1, 12 }, /* index 214 */
340 { 8, 1, 0, 146, 0, 2, 1, 12 }, /* index 215 */
341 { 8, 1, 0, 341, 0, 2, 1, 12 }, /* index 216 */
342 { 8, 1, 0, 1023, 0, 2, 1, 12 }, /* index 217 */
343 { 8, 1, 0, 682, 0, 2, 1, 12 }, /* index 218 */
344 { 9, 8, 1, 16, 0, 2, 7, 2 }, /* index 219 */
345 { 9, 4, 1, 528, 0, 1, 7, 2 }, /* index 220 */
346 { 9, 4, 0, 16, 0, 2, 7, 2 }, /* index 221 */
347 { 9, 2, 0, 528, 0, 1, 7, 2 }, /* index 222 */
348 { 9, 2, 0, 2, 0, 2, 7, 2 }, /* index 223 */
349 { 9, 2, 0, 16, 0, 2, 7, 2 }, /* index 224 */
350 { 9, 2, 0, 128, 0, 2, 7, 2 }, /* index 225 */
351 { 9, 1, 0, 16, 0, 1, 7, 2 }, /* index 226 */
352 { 9, 1, 0, 66, 0, 1, 7, 2 }, /* index 227 */
353 { 9, 1, 0, 528, 0, 1, 7, 2 }, /* index 228 */
354 { 9, 1, 0, 2, 0, 2, 7, 2 }, /* index 229 */
355 { 9, 1, 0, 128, 0, 2, 7, 2 }, /* index 230 */
356 { 9, 1, 0, 132, 0, 2, 7, 2 }, /* index 231 */
357 { 9, 1, 0, 146, 0, 2, 7, 2 }, /* index 232 */
358 { 9, 1, 0, 341, 0, 2, 7, 2 }, /* index 233 */
359 { 9, 1, 0, 1023, 0, 2, 7, 2 }, /* index 234 */
360 { 9, 1, 0, 682, 0, 2, 7, 2 }, /* index 235 */
361 {10, 16, 1, 528, 0, 1, 2, 6 }, /* index 236 */
362 {10, 16, 1, 16, 0, 2, 2, 6 }, /* index 237 */
363 {10, 8, 1, 528, 0, 1, 2, 6 }, /* index 238 */
364 {10, 8, 1, 16, 0, 2, 2, 6 }, /* index 239 */
365 {10, 4, 0, 528, 0, 1, 2, 6 }, /* index 240 */
366 {10, 4, 0, 16, 0, 2, 2, 6 }, /* index 241 */
367 {10, 2, 1, 580, 0, 2, 2, 6 }, /* index 242 */
368 {10, 2, 0, 2, 0, 2, 2, 6 }, /* index 243 */
369 {10, 2, 0, 16, 0, 2, 2, 6 }, /* index 244 */
370 {10, 2, 0, 128, 0, 2, 2, 6 }, /* index 245 */
371 {10, 1, 0, 16, 0, 1, 2, 6 }, /* index 246 */
372 {10, 1, 0, 66, 0, 1, 2, 6 }, /* index 247 */
373 {10, 1, 0, 528, 0, 1, 2, 6 }, /* index 248 */
374 {10, 1, 0, 1, 0, 2, 2, 6 }, /* index 249 */
375 {10, 1, 0, 128, 0, 2, 2, 6 }, /* index 250 */
376 {10, 1, 0, 132, 0, 2, 2, 6 }, /* index 251 */
377 {10, 1, 0, 146, 0, 2, 2, 6 }, /* index 252 */
378 {10, 1, 0, 341, 0, 2, 2, 6 }, /* index 253 */
379 {10, 1, 0, 1023, 0, 2, 2, 6 }, /* index 254 */
380 {10, 1, 0, 682, 0, 2, 2, 6 } /* index 255 */
383 /* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */
384 uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 };
386 uint16_t tbSizeTable[TOTAL_TBSIZE_VALUES] = {
387 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, \
388 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, \
389 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
390 336, 352, 368, 384, 408, 432, 456, 480, 504, 528, \
391 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, \
392 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
393 1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, \
394 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, \
395 2600, 2664, 2728, 2792, 2856, 2976, 3104, 3240, 3368, 3496, \
398 uint16_t mcsTable[32][3] = {
399 { 0, 2, 120}, /* mcs index 0 */
400 { 1, 2, 157}, /* mcs index 1 */
401 { 2, 2, 193}, /* mcs index 2 */
402 { 3, 2, 251}, /* mcs index 3 */
403 { 4, 2, 308}, /* mcs index 4 */
404 { 5, 2, 379}, /* mcs index 5 */
405 { 6, 2, 449}, /* mcs index 6 */
406 { 7, 2, 526}, /* mcs index 7 */
407 { 8, 2, 602}, /* mcs index 8 */
408 { 9, 2, 679}, /* mcs index 9 */
409 { 10, 4, 340}, /* mcs index 10 */
410 { 11, 4, 378}, /* mcs index 11 */
411 { 12, 4, 434}, /* mcs index 12 */
412 { 13, 4, 490}, /* mcs index 13 */
413 { 14, 4, 553}, /* mcs index 14 */
414 { 15, 4, 616}, /* mcs index 15 */
415 { 16, 4, 658}, /* mcs index 16 */
416 { 17, 6, 438}, /* mcs index 17 */
417 { 18, 6, 466}, /* mcs index 18 */
418 { 19, 6, 517}, /* mcs index 19 */
419 { 20, 6, 567}, /* mcs index 20 */
420 { 21, 6, 616}, /* mcs index 21 */
421 { 22, 6, 666}, /* mcs index 22 */
422 { 23, 6, 719}, /* mcs index 23 */
423 { 24, 6, 772}, /* mcs index 24 */
424 { 25, 6, 822}, /* mcs index 25 */
425 { 26, 6, 873}, /* mcs index 26 */
426 { 27, 6, 910}, /* mcs index 27 */
427 { 28, 6, 948}, /* mcs index 28 */
428 { 29, 2, 0}, /* mcs index 29 */
429 { 30, 4, 0}, /* mcs index 30 */
430 { 31, 6, 0}}; /* mcs index 31 */
432 /* PUCCH resource sets before dedicated PUCCH resource configuration */
433 /* Table 9.2.1-1 spec 38.213 */
434 uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = {
435 { 0, 12, 2, 0 }, /* index 0 */
436 { 0, 12, 2, 0 }, /* index 1 */
437 { 0, 12, 2, 3 }, /* index 2 */
438 { 1, 10, 4, 0 }, /* index 3 */
439 { 1, 10, 4, 0 }, /* index 4 */
440 { 1, 10, 4, 2 }, /* index 5 */
441 { 1, 10, 4, 4 }, /* index 6 */
442 { 1, 4, 10, 0 }, /* index 7 */
443 { 1, 4, 10, 0 }, /* index 8 */
444 { 1, 4, 10, 2 }, /* index 9 */
445 { 1, 4, 10, 4 }, /* index 10 */
446 { 1, 0, 14, 0 }, /* index 11 */
447 { 1, 0, 14, 0 }, /* index 12 */
448 { 1, 0, 14, 2 }, /* index 13 */
449 { 1, 0, 14, 4 }, /* index 14 */
450 { 1, 0, 14, 0 }, /* index 15 */
454 * @brief frequency domain allocation function.
458 * Function: schAllocFreqDomRscType0
460 * This function does allocation in frequency domain resource.
461 * This is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
463 * @param[in] startPrb - start PRB from where the freq alloc starts.
464 * @param[in] prbSize - number of PRBs to be allocted.
465 * @param[in] freqDomain - 6 bytes of info, each bit represents a group of 6 PRB.
468 void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
470 uint8_t remBits = prbSize; /* each bit represents 6 PRBs */
471 uint8_t firstByte = 1;
472 uint8_t numBits,startBit,byteCount = 5;
476 /* when the startPrb is not in this byteCount */
484 /* max bytecount is 6 nearly equal to 45 bits*/
488 /* when we are filling the second byte, then the start should be equal to 0 */
494 /* calculate the number of bits to be set in this byte */
495 if((remBits+startPrb) <= 8)
498 numBits = 8 - startBit;
500 /* bit operation to set the bits */
501 SET_BITS_MSB((startBit % 8),numBits,freqDomain[byteCount])
504 /* the ramaining bits should be subtracted with the numBits set in this byte */
511 * @brief frequency domain allocation function.
515 * Function: schCalcTbSize
517 * This function finds the TBSize from table Table 5.1.3.2-1 spec 38.214
519 * @param[in] payLoadSize - size of payload
520 * @return TBsize from the Table
522 uint16_t schCalcTbSize(uint16_t payLoadSize)
524 uint8_t tbsIndex = 0;
525 payLoadSize = payLoadSize*8;
527 while(payLoadSize > tbSizeTable[tbsIndex])
532 /* return the TBsize in bytes */
533 return (tbSizeTable[tbsIndex]/8);
537 * @brief frequency domain allocation function.
541 * Function: schCalcNumPrb
543 * This function calculates the number of PRbs
547 * @param[in] number of symbols
548 * @return number PRBs
550 uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
554 uint16_t nreDash = 0;
555 uint8_t qm = mcsTable[mcs][1];
556 uint16_t rValue = mcsTable[mcs][2];
557 uint8_t numLayer = 1; /* v value */
558 uint8_t numDmrsSymbols = 12; /* considering whole of one symbols with 12 SCs for DMRS */
560 /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 *
561 * Ninfo = Nre . R . Qm . v *
562 * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh *
563 * Nre = min(156,Nre') . nPrb */
565 nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer));
567 nreDash = ceil( (12 * numSymbols) - numDmrsSymbols - 0);
572 numPrb = ceil((float)nre / nreDash);
576 /**********************************************************************
578 **********************************************************************/