319ef9457b9d3e1144506530616cd50f627e73a6
[o-du/l2.git] / src / du_app / du_utils.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2020] [Radisys]                                             #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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  *******************************************************************************/
18 /* Utility definitions to be used in du app */
19 #include "common_def.h"
20 #include "du_app_mac_inf.h"
21 #include "du_utils.h"
22
23 /* Spec Ref-38.214-Table 5.1.2.1-1 */
24 uint8_t slivCfgIdxTable[MAX_SLIV_CONFIG_IDX][3] = {
25 /*S    L     SLIV*/
26 { 0,   1,    0  },/* index0  */
27 { 0,   2,    14 },/* index1  */
28 { 0,   3,    28 },/* index2  */
29 { 0,   4,    42 },/* index3  */
30 { 0,   5,    56 },/* index4  */
31 { 0,   6,    70 },/* index5  */
32 { 0,   7,    84 },/* index6  */
33 { 0,   8,    98 },/* index7  */
34 { 0,   9,    97 },/* index8  */
35 { 0,   10,   83 },/* index9  */
36 { 0,   11,   69 },/* index10 */
37 { 0,   12,   55 },/* index11 */
38 { 0,   13,   41 },/* index12 */
39 { 0,   14,   27 },/* index13 */
40 { 1,   1,    1  },/* index14 */
41 { 1,   2,    15 },/* index15 */
42 { 1,   3,    29 },/* index16 */
43 { 1,   4,    43 },/* index17 */
44 { 1,   5,    57 },/* index18 */
45 { 1,   6,    71 },/* index19 */
46 { 1,   7,    85 },/* index20 */
47 { 1,   8,    99 },/* index21 */
48 { 1,   9,    96 },/* index22 */
49 { 1,   10,   82 },/* index23 */
50 { 1,   11,   68 },/* index24 */
51 { 1,   12,   54 },/* index25 */
52 { 1,   13,   40 },/* index26 */
53 { 2,   1,    2  },/* index27 */
54 { 2,   2,    16 },/* index28 */
55 { 2,   3,    30 },/* index29 */
56 { 2,   4,    44 },/* index30 */
57 { 2,   5,    58 },/* index31 */
58 { 2,   6,    72 },/* index32 */
59 { 2,   7,    86 },/* index33 */
60 { 2,   8,    100},/* index34 */
61 { 2,   9,    95 },/* index35 */
62 { 2,   10,   81 },/* index36 */
63 { 2,   11,   67 },/* index37 */
64 { 2,   12,   53 },/* index38 */
65 { 3,   1,    3  },/* index39 */
66 { 3,   2,    17 },/* index40 */
67 { 3,   3,    31 },/* index41 */
68 { 3,   4,    45 },/* index42 */
69 { 3,   5,    59 },/* index43 */
70 { 3,   6,    73 },/* index44 */
71 { 3,   7,    87 },/* index45 */
72 { 3,   8,    101},/* index46 */
73 { 3,   9,    94 },/* index47 */
74 { 3,   10,   80 },/* index48 */
75 { 3,   11,   66 },/* index49 */
76 { 4,   1,    4  },/* index50 */
77 { 4,   2,    18 },/* index51 */
78 { 4,   3,    32 },/* index52 */
79 { 4,   4,    46 },/* index53 */
80 { 4,   5,    60 },/* index54 */
81 { 4,   6,    74 },/* index55 */
82 { 4,   7,    88 },/* index56 */
83 { 4,   8,    102},/* index57 */
84 { 4,   9,    93 },/* index58 */
85 { 4,   10,   79 },/* index59 */
86 { 5,   1,    5  },/* index60 */
87 { 5,   2,    19 },/* index61 */
88 { 5,   3,    33 },/* index62 */
89 { 5,   4,    47 },/* index63 */
90 { 5,   5,    61 },/* index64 */
91 { 5,   6,    75 },/* index65 */
92 { 5,   7,    89 },/* index66 */
93 { 5,   8,    103},/* index67 */
94 { 5,   9,    92 },/* index68 */
95 { 6,   1,    6  },/* index69 */
96 { 6,   2,    20 },/* index70 */
97 { 6,   3,    34 },/* index71 */
98 { 6,   4,    48 },/* index72 */
99 { 6,   5,    62 },/* index73 */
100 { 6,   6,    76 },/* index74 */
101 { 6,   7,    90 },/* index75 */
102 { 6,   8,    104},/* index76 */
103 { 7,   1,    7  },/* index77 */
104 { 7,   2,    21 },/* index78 */
105 { 7,   3,    35 },/* index79 */
106 { 7,   4,    49 },/* index80 */
107 { 7,   5,    63 },/* index81 */
108 { 7,   6,    77 },/* index82 */
109 { 7,   7,    91 },/* index83 */
110 { 8,   1,    8  },/* index84 */
111 { 8,   2,    22 },/* index85 */
112 { 8,   3,    36 },/* index86 */
113 { 8,   4,    50 },/* index87 */
114 { 8,   5,    64 },/* index88 */
115 { 8,   6,    78 },/* index89 */
116 { 9,   1,    9  },/* index90 */
117 { 9,   2,    23 },/* index91 */
118 { 9,   3,    37 },/* index92 */
119 { 9,   4,    51 },/* index93 */
120 { 9,   5,    65 },/* index94 */
121 { 10,  1,    10 },/* index95 */
122 { 10,  2,    24 },/* index96 */
123 { 10,  3,    38 },/* index97 */
124 { 10,  4,    52 },/* index98 */
125 { 11,  1,    11 },/* index99 */
126 { 11,  2,    25 },/* index100*/
127 { 11,  3,    39 },/* index101*/
128 { 12,  1,    12 },/* index102*/
129 { 12,  2,    26 },/* index103*/
130 { 13,  1,    13 } /* index104*/
131 };
132
133 /*******************************************************************
134  *
135  * @brief Function to fill the start Symbol and Symbol Len from the 
136  * sliv Config Idx Table
137  *
138  * @details
139  *
140  *    Function : fillStartSymbolAndLen
141  *
142  *    Functionality: Function to fill the start Symbol and Symbol Len 
143  *                   from the sliv Config Idx Table
144  *
145  * @params[in] startSymbolIdx pointer,
146  *             symbolLen pointer,
147  *             sliv
148  * @return void
149  *
150  * ****************************************************************/
151 void fillStartSymbolAndLen(uint8_t numRsrcAlloc, PdschConfig *pdschCfg, PuschCfg *puschCfg)
152 {
153    uint8_t slivIdx, timeDomIdx;
154
155    for(timeDomIdx = 0; timeDomIdx < numRsrcAlloc; timeDomIdx++)
156    {
157       for(slivIdx = 0; slivIdx < MAX_SLIV_CONFIG_IDX; slivIdx++)
158       {
159          if(pdschCfg)/* PDSCH Config */
160          {
161             if(pdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength ==\
162                slivCfgIdxTable[slivIdx][2])
163             {
164                pdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbol  = slivCfgIdxTable[slivIdx][0];
165                pdschCfg->timeDomRsrcAllociList[timeDomIdx].symbolLength = slivCfgIdxTable[slivIdx][1];
166                break;
167             }
168          }
169          if(puschCfg)/* PUSCH Config */
170          {
171             if(puschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength ==\
172                slivCfgIdxTable[slivIdx][2])
173             {
174                puschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbol  = slivCfgIdxTable[slivIdx][0];
175                puschCfg->timeDomRsrcAllocList[timeDomIdx].symbolLength = slivCfgIdxTable[slivIdx][1];
176                break;
177             }
178
179          }
180       }
181    }
182 }
183
184 /**********************************************************************
185 End of file
186 **********************************************************************/
187