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 #include "common_def.h"
22 * @brief frequency domain allocation function.
26 * Function: schAllocFreqDomRscType0
28 * This function does allocation in frequency domain resource.
29 * This is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
31 * @param[in] startPrb - start PRB from where the freq alloc starts.
32 * @param[in] prbSize - number of PRBs to be allocted.
33 * @param[in] freqDomain - 6 bytes of info, each bit represents a group of 6 PRB.
36 void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
38 uint8_t remBits = prbSize; /* each bit represents 6 PRBs */
39 uint8_t firstByte = 1;
40 uint8_t numBits,startBit,byteCount = 5;
44 /* when the startPrb is not in this byteCount */
52 /* max bytecount is 6 nearly equal to 45 bits*/
56 /* when we are filling the second byte, then the start should be equal to 0 */
62 /* calculate the number of bits to be set in this byte */
63 if((remBits+startPrb) <= 8)
66 numBits = 8 - startBit;
68 /* bit operation to set the bits */
69 SET_BITS_MSB((startBit % 8),numBits,freqDomain[byteCount])
72 /* the ramaining bits should be subtracted with the numBits set in this byte */
80 /**********************************************************************
82 **********************************************************************/