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"
38 /* spec-38.213 Table 13-1 */
39 int8_t coresetIdxTable[MAX_CORESET_INDEX][4] = {
40 { 1, 24, 2, 0}, /* index 0 */
41 { 1, 24, 2, 2}, /* index 1 */
42 { 1, 24, 2, 4}, /* index 2 */
43 { 1, 24, 3, 0}, /* index 3 */
44 { 1, 24, 3, 2}, /* index 4 */
45 { 1, 24, 3, 4}, /* index 5 */
46 { 1, 48, 1, 12}, /* index 6 */
47 { 1, 48, 1, 16}, /* index 7 */
48 { 1, 48, 2, 12}, /* index 8 */
49 { 1, 48, 2, 16}, /* index 9 */
50 { 1, 48, 3, 12}, /* index 10 */
51 { 1, 48, 3, 16}, /* index 11 */
52 { 1, 96, 1, 38}, /* index 12 */
53 { 1, 96, 2, 38}, /* index 13 */
54 { 1, 96, 3, 38}, /* index 14 */
55 { 0, 0, 0, 0}, /* index 15 */
58 /* spec-38.213 Table 13-11 */
59 /* m value is scaled to 2, when using it in formula, divide by 2 */
60 /* firstSymbol will vary depends on i, hence not filled */
61 int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4] = {
62 { 0, 1, 2, 0}, /* index 0 */
63 { 0, 2, 1, 0}, /* index 1 */
64 { 2, 1, 2, 0}, /* index 2 */
65 { 2, 2, 1, 0}, /* index 3 */
66 { 5, 1, 2, 0}, /* index 4 */
67 { 5, 2, 1, 0}, /* index 5 */
68 { 7, 1, 2, 0}, /* index 6 */
69 { 7, 2, 1, 0}, /* index 7 */
70 { 0, 1, 4, 0}, /* index 8 */
71 { 5, 1, 4, 0}, /* index 9 */
72 { 0, 1, 2, 0}, /* index 10 */
73 { 0, 1, 2, 0}, /* index 11 */
74 { 2, 1, 2, 0}, /* index 12 */
75 { 2, 1, 2, 0}, /* index 13 */
76 { 5, 1, 2, 0}, /* index 14 */
77 { 5, 1, 2, 0}, /* index 15 */
80 * @brief frequency domain allocation function.
84 * Function : freqDomResourceAlloc
86 * This function does allocation in frequency domain resource. using
87 * bitwise operator, the bits are set for the PRBs.
89 * @param[in] startPrb - start PRB from where the freq alloc starts.
90 * @param[in] prbSize - number of PRBs to be allocted.
91 * @param[in] freqDomain - 6 bytes of info, each bit represents a group of 6 PRB.
94 void freqDomResourceAlloc(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
96 uint8_t remBits = prbSize; /* each bit represents 6 PRBs */
97 uint8_t firstByte = 1;
98 uint8_t numBits,startBit,byteCount = 0;
102 /* when the startPrb is not in this byteCount */
110 /* max bytecount is 6 nearly equal to 45 bits*/
114 /* when we are filling the second byte, then the start should be equal to 0 */
120 /* calculate the number of bits to be set in this byte */
121 if((remBits+startPrb) <= 8)
124 numBits = 8 - startBit;
126 /* bit operation to set the bits */
127 SET_BITS((startBit % 8),numBits,freqDomain[byteCount])
130 /* the ramaining bits should be subtracted with the numBits set in this byte */
136 /**********************************************************************
138 **********************************************************************/