* INTC Contribution to the O-RAN F Release for O-DU Low
[o-du/phy.git] / fhi_lib / lib / src / xran_frame_struct.c
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 Intel.
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
19 /**
20  * @brief XRAN layer common functionality for both lls-CU and RU as well as C-plane and
21  *    U-plane
22  * @file xran_common.c
23  * @ingroup group_source_xran
24  * @author Intel Corporation
25  **/
26
27 #include <assert.h>
28 #include <err.h>
29 #include <arpa/inet.h>
30 #include <sys/time.h>
31 #include <time.h>
32
33 #include "xran_frame_struct.h"
34 #include "xran_printf.h"
35
36 enum nXranChBwOptions
37 {
38     XRAN_BW_5_0_MHZ  = 5,  XRAN_BW_10_0_MHZ = 10, XRAN_BW_15_0_MHZ = 15, XRAN_BW_20_0_MHZ = 20, XRAN_BW_25_0_MHZ = 25,
39     XRAN_BW_30_0_MHZ = 30, XRAN_BW_40_0_MHZ = 40, XRAN_BW_50_0_MHZ = 50, XRAN_BW_60_0_MHZ = 60, XRAN_BW_70_0_MHZ = 70,
40     XRAN_BW_80_0_MHZ = 80, XRAN_BW_90_0_MHZ = 90, XRAN_BW_100_0_MHZ = 100, XRAN_BW_200_0_MHZ = 200, XRAN_BW_400_0_MHZ = 400
41 };
42
43 // F1 Tables 38.101-1 Table 5.3.2-1. Maximum transmission bandwidth configuration NRB
44 static uint16_t nNumRbsPerSymF1[3][13] =
45 {
46     //  5MHz    10MHz   15MHz   20 MHz  25 MHz  30 MHz  40 MHz  50MHz   60 MHz  70 MHz  80 MHz   90 MHz  100 MHz
47         {25,    52,     79,     106,    133,    160,    216,    270,    0,         0,      0,      0,      0},         // Numerology 0 (15KHz)
48         {11,    24,     38,     51,     65,     78,     106,    133,    162,       0,    217,    245,    273},         // Numerology 1 (30KHz)
49         {0,     11,     18,     24,     31,     38,     51,     65,     79,        0,    107,    121,    135}          // Numerology 2 (60KHz)
50 };
51
52 // F2 Tables 38.101-2 Table 5.3.2-1. Maximum transmission bandwidth configuration NRB
53 static uint16_t nNumRbsPerSymF2[2][4] =
54 {
55     //  50Mhz  100MHz  200MHz   400MHz
56         {66,    132,    264,     0},        // Numerology 2 (60KHz)
57         {32,    66,     132,     264}       // Numerology 3 (120KHz)
58 };
59
60 // 38.211 - Table 4.2.1
61 static uint16_t nSubCarrierSpacing[5] =
62 {
63     15,     // mu = 0
64     30,     // mu = 1
65     60,     // mu = 2
66     120,    // mu = 3
67     240     // mu = 4
68 };
69
70 // TTI interval in us (slot duration)
71 static uint16_t nTtiInterval[4] =
72 {
73     1000,    // mu = 0
74     500,     // mu = 1
75     250,     // mu = 2
76     125     // mu = 3
77 };
78
79 #if 0
80 // F1 Tables 38.101-1 Table F.5.3. Window length for normal CP
81 static uint16_t nCpSizeF1[3][13][2] =
82 {
83     //    5MHz      10MHz      15MHz       20 MHz      25 MHz     30 MHz      40 MHz       50MHz       60 MHz      70 MHz     80 MHz     90 MHz     100 MHz
84         {{40, 36}, {80, 72}, {120, 108}, {160, 144}, {160, 144}, {240, 216}, {320, 288}, {320, 288},     {0, 0},     {0, 0},     {0, 0},     {0, 0},     {0, 0}},        // Numerology 0 (15KHz)
85         {{22, 18}, {44, 36},   {66, 54},   {88, 72},   {88, 72}, {132, 108}, {176, 144}, {176, 144}, {264, 216}, {264, 216}, {352, 288}, {352, 288}, {352, 288}},       // Numerology 1 (30KHz)
86         {  {0, 0}, {26, 18},   {39, 27},   {52, 36},   {52, 36},   {78, 54},  {104, 72},  {104, 72}, {156, 108}, {156, 108}, {208, 144}, {208, 144}, {208, 144}},       // Numerology 2 (60KHz)
87 };
88
89 // F2 Tables 38.101-2 Table F.5.3. Window length for normal CP
90 static int16_t nCpSizeF2[2][4][2] =
91 {
92     //    50Mhz    100MHz      200MHz     400MHz
93         {  {0, 0}, {104, 72}, {208, 144}, {416, 288}}, // Numerology 2 (60KHz)
94         {{68, 36}, {136, 72}, {272, 144}, {544, 288}}, // Numerology 3 (120KHz)
95 };
96 #endif
97
98
99 static uint32_t xran_fs_max_slot_num[XRAN_PORTS_NUM] = {8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000};
100 static uint32_t xran_fs_max_slot_num_SFN[XRAN_PORTS_NUM] = {20480,20480,20480,20480,20480,20480,20480,20480}; /* max slot number counted as SFN is 0-1023 */
101 static uint16_t xran_fs_num_slot_tdd_loop[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR] = {{ XRAN_NUM_OF_SLOT_IN_TDD_LOOP }};
102 static uint16_t xran_fs_num_dl_sym_sp[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR][XRAN_NUM_OF_SLOT_IN_TDD_LOOP] = {{{0}}};
103 static uint16_t xran_fs_num_ul_sym_sp[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR][XRAN_NUM_OF_SLOT_IN_TDD_LOOP] = {{{0}}};
104 static uint8_t xran_fs_slot_type[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR][XRAN_NUM_OF_SLOT_IN_TDD_LOOP] = {{{XRAN_SLOT_TYPE_INVALID}}};
105 static uint8_t xran_fs_slot_symb_type[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR][XRAN_NUM_OF_SLOT_IN_TDD_LOOP][XRAN_NUM_OF_SYMBOL_PER_SLOT] = {{{{XRAN_SLOT_TYPE_INVALID}}}};
106 static float xran_fs_ul_rate[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR] = {{0.0}};
107 static float xran_fs_dl_rate[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR] = {{0.0}};
108
109 extern uint16_t xran_max_frame;
110
111 uint32_t xran_fs_get_tti_interval(uint8_t nMu)
112 {
113     if (nMu < 4)
114     {
115         return nTtiInterval[nMu];
116     }
117     else
118     {
119         printf("ERROR: %s Mu[%d] is not valid, setting to 0\n",__FUNCTION__, nMu);
120         return nTtiInterval[0];
121     }
122 }
123
124 uint32_t xran_fs_get_scs(uint8_t nMu)
125 {
126     if (nMu <= 3)
127     {
128         return nSubCarrierSpacing[nMu];
129     }
130     else
131     {
132         printf("ERROR: %s Mu[%d] is not valid\n",__FUNCTION__, nMu);
133     }
134
135     return 0;
136 }
137
138 //-------------------------------------------------------------------------------------------
139 /** @ingroup group_nr5g_source_phy_common
140  *
141  *  @param[in]   nNumerology - Numerology determine sub carrier spacing, Value: 0->4 0: 15khz,  1: 30khz,  2: 60khz 3: 120khz, 4: 240khz
142  *  @param[in]   nBandwidth - Carrier bandwidth for in MHz. Value: 5->400
143  *  @param[in]   nAbsFrePointA - Abs Freq Point A of the Carrier Center Frequency for in KHz Value: 450000->52600000
144  *
145  *  @return  Number of RBs in cell
146  *
147  *  @description
148  *  Returns number of RBs based on 38.101-1 and 38.101-2 for the cell
149  *
150 **/
151 //-------------------------------------------------------------------------------------------
152 uint16_t xran_fs_get_num_rbs(uint32_t nNumerology, uint32_t nBandwidth, uint32_t nAbsFrePointA)
153 {
154     uint32_t error = 1;
155     uint16_t numRBs = 0;
156
157     if (nAbsFrePointA <= 6000000)
158     {
159         // F1 Tables 38.101-1 Table 5.3.2-1. Maximum transmission bandwidth configuration NRB
160         if (nNumerology < 3)
161         {
162             switch(nBandwidth)
163             {
164                 case XRAN_BW_5_0_MHZ:
165                     numRBs = nNumRbsPerSymF1[nNumerology][0];
166                     error = 0;
167                 break;
168                 case XRAN_BW_10_0_MHZ:
169                     numRBs = nNumRbsPerSymF1[nNumerology][1];
170                     error = 0;
171                 break;
172                 case XRAN_BW_15_0_MHZ:
173                     numRBs = nNumRbsPerSymF1[nNumerology][2];
174                     error = 0;
175                 break;
176                 case XRAN_BW_20_0_MHZ:
177                     numRBs = nNumRbsPerSymF1[nNumerology][3];
178                     error = 0;
179                 break;
180                 case XRAN_BW_25_0_MHZ:
181                     numRBs = nNumRbsPerSymF1[nNumerology][4];
182                     error = 0;
183                 break;
184                 case XRAN_BW_30_0_MHZ:
185                     numRBs = nNumRbsPerSymF1[nNumerology][5];
186                     error = 0;
187                 break;
188                 case XRAN_BW_40_0_MHZ:
189                     numRBs = nNumRbsPerSymF1[nNumerology][6];
190                     error = 0;
191                 break;
192                 case XRAN_BW_50_0_MHZ:
193                     numRBs = nNumRbsPerSymF1[nNumerology][7];
194                     error = 0;
195                 break;
196                 case XRAN_BW_60_0_MHZ:
197                     numRBs = nNumRbsPerSymF1[nNumerology][8];
198                     error = 0;
199                 break;
200                 case XRAN_BW_70_0_MHZ:
201                     numRBs = nNumRbsPerSymF1[nNumerology][9];
202                     error = 0;
203                 break;
204                 case XRAN_BW_80_0_MHZ:
205                     numRBs = nNumRbsPerSymF1[nNumerology][10];
206                     error = 0;
207                 break;
208                 case XRAN_BW_90_0_MHZ:
209                     numRBs = nNumRbsPerSymF1[nNumerology][11];
210                     error = 0;
211                 break;
212                 case XRAN_BW_100_0_MHZ:
213                     numRBs = nNumRbsPerSymF1[nNumerology][12];
214                     error = 0;
215                 break;
216                 default:
217                     error = 1;
218                 break;
219             }
220         }
221     }
222     else
223     {
224         if ((nNumerology >= 2) && (nNumerology <= 3))
225         {
226             // F2 Tables 38.101-2 Table 5.3.2-1. Maximum transmission bandwidth configuration NRB
227             switch(nBandwidth)
228             {
229                 case XRAN_BW_50_0_MHZ:
230                     numRBs = nNumRbsPerSymF2[nNumerology-2][0];
231                     error = 0;
232                 break;
233                 case XRAN_BW_100_0_MHZ:
234                     numRBs = nNumRbsPerSymF2[nNumerology-2][1];
235                     error = 0;
236                 break;
237                 case XRAN_BW_200_0_MHZ:
238                     numRBs = nNumRbsPerSymF2[nNumerology-2][2];
239                     error = 0;
240                 break;
241                 case XRAN_BW_400_0_MHZ:
242                     numRBs = nNumRbsPerSymF2[nNumerology-2][3];
243                     error = 0;
244                 break;
245                 default:
246                     error = 1;
247                 break;
248             }
249         }
250     }
251
252
253     if (error)
254     {
255         printf("ERROR: %s: nNumerology[%d] nBandwidth[%d] nAbsFrePointA[%d]\n",__FUNCTION__, nNumerology, nBandwidth, nAbsFrePointA);
256     }
257     else
258     {
259         printf("%s: nNumerology[%d] nBandwidth[%d] nAbsFrePointA[%d] numRBs[%d]\n",__FUNCTION__, nNumerology, nBandwidth, nAbsFrePointA, numRBs);
260     }
261
262     return numRBs;
263 }
264
265 //-------------------------------------------------------------------------------------------
266 /** @ingroup phy_cal_nrarfcn
267  *
268  *  @param[in]   center frequency
269  *
270  *  @return  NR-ARFCN
271  *
272  *  @description
273  *  This calculates NR-ARFCN value according to center frequency
274  *
275 **/
276 //-------------------------------------------------------------------------------------------
277 uint32_t xran_fs_cal_nrarfcn(uint32_t nCenterFreq)
278 {
279     uint32_t nDeltaFglobal,nFoffs,nNoffs;
280     uint32_t nNRARFCN = 0;
281
282     if(nCenterFreq > 0 && nCenterFreq < 3000*1000)
283     {
284         nDeltaFglobal = 5;
285         nFoffs = 0;
286         nNoffs = 0;
287     }
288     else if(nCenterFreq >= 3000*1000 && nCenterFreq < 24250*1000)
289     {
290         nDeltaFglobal = 15;
291         nFoffs = 3000*1000;
292         nNoffs = 600000;
293     }
294     else if(nCenterFreq >= 24250*1000 && nCenterFreq <= 100000*1000)
295     {
296         nDeltaFglobal = 60;
297         nFoffs = 24250080;
298         nNoffs = 2016667;
299     }
300     else
301     {
302          printf("@@@@ incorrect center frerquency %d\n",nCenterFreq);
303          return (0);
304     }
305
306     nNRARFCN = ((nCenterFreq - nFoffs)/nDeltaFglobal) + nNoffs;
307
308     printf("%s: nCenterFreq[%d] nDeltaFglobal[%d] nFoffs[%d] nNoffs[%d] nNRARFCN[%d]\n", __FUNCTION__, nCenterFreq, nDeltaFglobal, nFoffs, nNoffs, nNRARFCN);
309     return (nNRARFCN);
310 }
311
312 uint32_t  xran_fs_slot_limit_init(uint32_t PortId, int32_t tti_interval_us)
313 {
314     xran_fs_max_slot_num[PortId] = (1000/tti_interval_us)*1000;
315     xran_fs_max_slot_num_SFN[PortId] = (1000/tti_interval_us)*(xran_max_frame+1)*10;
316     return xran_fs_max_slot_num[PortId];
317 }
318
319 uint32_t xran_fs_get_max_slot(uint32_t PortId)
320 {
321     return xran_fs_max_slot_num[PortId];
322 }
323
324 uint32_t xran_fs_get_max_slot_SFN(uint32_t PortId)
325 {
326     return xran_fs_max_slot_num_SFN[PortId];
327 }
328
329 int32_t xran_fs_slot_limit(uint32_t PortId, int32_t nSfIdx)
330 {
331     while (nSfIdx < 0) {
332         nSfIdx += xran_fs_max_slot_num[PortId];
333     }
334
335     while (nSfIdx >= xran_fs_max_slot_num[PortId]) {
336         nSfIdx -= xran_fs_max_slot_num[PortId];
337     }
338
339     return nSfIdx;
340 }
341
342 void xran_fs_clear_slot_type(uint32_t PortId, uint32_t nPhyInstanceId)
343 {
344     xran_fs_ul_rate[PortId][nPhyInstanceId] = 0.0;
345     xran_fs_dl_rate[PortId][nPhyInstanceId] = 0.0;
346     xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId] = 1;
347 }
348
349 int32_t xran_fs_set_slot_type(uint32_t PortId, uint32_t nPhyInstanceId, uint32_t nFrameDuplexType, uint32_t nTddPeriod, struct xran_slot_config* psSlotConfig)
350 {
351     uint32_t nSlotNum, nSymNum, nVal, i, j;
352     uint32_t numDlSym, numUlSym, numGuardSym;
353     uint32_t numDlSlots = 0, numUlSlots = 0, numSpDlSlots = 0, numSpUlSlots = 0, numSpSlots = 0;
354 #ifdef PRINTF_DBG_OK
355     char sSlotPattern[XRAN_SLOT_TYPE_LAST][10] = {"IN\0", "DL\0", "UL\0", "SP\0", "FD\0"};
356 #endif
357
358     // nPhyInstanceId    Carrier ID
359     // nFrameDuplexType  0 = FDD 1 = TDD
360     // nTddPeriod        Tdd Periodicity
361     // psSlotConfig[80]  Slot Config Structure for nTddPeriod Slots
362
363     xran_fs_ul_rate[PortId][nPhyInstanceId] = 0.0;
364     xran_fs_dl_rate[PortId][nPhyInstanceId] = 0.0;
365     xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId] = nTddPeriod;
366
367     for (i = 0; i < XRAN_NUM_OF_SLOT_IN_TDD_LOOP; i++)
368     {
369         xran_fs_slot_type[PortId][nPhyInstanceId][i] = XRAN_SLOT_TYPE_INVALID;
370         xran_fs_num_dl_sym_sp[PortId][nPhyInstanceId][i] = 0;
371         xran_fs_num_ul_sym_sp[PortId][nPhyInstanceId][i] = 0;
372     }
373
374     if (nFrameDuplexType == XRAN_FDD)
375     {
376         for (i = 0; i < XRAN_NUM_OF_SLOT_IN_TDD_LOOP; i++)
377         {
378             xran_fs_slot_type[PortId][nPhyInstanceId][i] = XRAN_SLOT_TYPE_FDD;
379             for(j = 0; j < XRAN_NUM_OF_SYMBOL_PER_SLOT; j++)
380               xran_fs_slot_symb_type[PortId][nPhyInstanceId][i][j] = XRAN_SYMBOL_TYPE_FDD;
381         }
382         xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId] = 1;
383         xran_fs_dl_rate[PortId][nPhyInstanceId] = 1.0;
384         xran_fs_ul_rate[PortId][nPhyInstanceId] = 1.0;
385     }
386     else
387     {
388         for (nSlotNum = 0; nSlotNum < nTddPeriod; nSlotNum++)
389         {
390             numDlSym = 0;
391             numUlSym = 0;
392             numGuardSym = 0;
393             for (nSymNum = 0; nSymNum < XRAN_NUM_OF_SYMBOL_PER_SLOT; nSymNum++)
394             {
395                 switch(psSlotConfig[nSlotNum].nSymbolType[nSymNum])
396                 {
397                     case XRAN_SYMBOL_TYPE_DL:
398                         numDlSym++;
399                         xran_fs_slot_symb_type[PortId][nPhyInstanceId][nSlotNum][nSymNum] = XRAN_SYMBOL_TYPE_DL;
400                     break;
401                     case XRAN_SYMBOL_TYPE_GUARD:
402                         xran_fs_slot_symb_type[PortId][nPhyInstanceId][nSlotNum][nSymNum] = XRAN_SYMBOL_TYPE_GUARD;
403                         numGuardSym++;
404                     break;
405                     default:
406                         xran_fs_slot_symb_type[PortId][nPhyInstanceId][nSlotNum][nSymNum] = XRAN_SYMBOL_TYPE_UL;
407                         numUlSym++;
408                     break;
409                 }
410             }
411
412             print_dbg("nSlotNum[%d] : numDlSym[%d] numGuardSym[%d] numUlSym[%d] ", nSlotNum, numDlSym, numGuardSym, numUlSym);
413
414             if ((numUlSym == 0) && (numGuardSym == 0))
415             {
416                 xran_fs_slot_type[PortId][nPhyInstanceId][nSlotNum] = XRAN_SLOT_TYPE_DL;
417                 numDlSlots++;
418                 print_dbg("XRAN_SLOT_TYPE_DL\n");
419             }
420             else if ((numDlSym == 0) && (numGuardSym == 0))
421             {
422                 xran_fs_slot_type[PortId][nPhyInstanceId][nSlotNum] = XRAN_SLOT_TYPE_UL;
423                 numUlSlots++;
424                 print_dbg("XRAN_SLOT_TYPE_UL\n");
425             }
426             else
427             {
428                 xran_fs_slot_type[PortId][nPhyInstanceId][nSlotNum] = XRAN_SLOT_TYPE_SP;
429                 numSpSlots++;
430                 print_dbg("XRAN_SLOT_TYPE_SP\n");
431
432                 if (numDlSym)
433                 {
434                     numSpDlSlots++;
435                     xran_fs_num_dl_sym_sp[PortId][nPhyInstanceId][nSlotNum] = numDlSym;
436                 }
437                 if (numUlSym)
438                 {
439                     numSpUlSlots++;
440                     xran_fs_num_ul_sym_sp[PortId][nPhyInstanceId][nSlotNum] = numUlSym;
441                 }
442             }
443             print_dbg("            numDlSlots[%d] numUlSlots[%d] numSpSlots[%d] numSpDlSlots[%d] numSpUlSlots[%d]\n", numDlSlots, numUlSlots, numSpSlots, numSpDlSlots, numSpUlSlots);
444         }
445
446         xran_fs_dl_rate[PortId][nPhyInstanceId] = (float)(numDlSlots + numSpDlSlots) / (float)nTddPeriod;
447         xran_fs_ul_rate[PortId][nPhyInstanceId] = (float)(numUlSlots + numSpUlSlots) / (float)nTddPeriod;
448     }
449
450     print_dbg("%s: nPhyInstanceId[%d] nFrameDuplexType[%d], nTddPeriod[%d]\n",
451         __FUNCTION__, nPhyInstanceId, nFrameDuplexType, nTddPeriod);
452
453     print_dbg("DLRate[%f] ULRate[%f]\n", xran_fs_dl_rate[PortId][nPhyInstanceId], xran_fs_ul_rate[PortId][nPhyInstanceId]);
454
455     nVal = (xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId] < 10) ? xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId] : 10;
456
457     print_dbg("SlotPattern:\n");
458     print_dbg("Slot:   ");
459     for (nSlotNum = 0; nSlotNum < nVal; nSlotNum++)
460     {
461         print_dbg("%d    ", nSlotNum);
462     }
463     print_dbg("\n");
464
465     print_dbg("  %3d   ", 0);
466     for (nSlotNum = 0, i = 0; nSlotNum < xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId]; nSlotNum++)
467     {
468         print_dbg("%s   ", sSlotPattern[xran_fs_slot_type[PortId][nPhyInstanceId][nSlotNum]]);
469         i++;
470         if ((i == 10) && ((nSlotNum+1) < xran_fs_num_slot_tdd_loop[PortId][nPhyInstanceId]))
471         {
472             print_dbg("\n");
473             print_dbg("  %3d   ", nSlotNum);
474             i = 0;
475         }
476     }
477     print_dbg("\n\n");
478
479     return 0;
480 }
481
482 int32_t xran_fs_get_slot_type(uint32_t PortId, int32_t nCellIdx, int32_t nSlotdx, int32_t nType)
483 {
484     int32_t nSfIdxMod, nSfType, ret = 0;
485
486     nSfIdxMod = xran_fs_slot_limit(PortId, nSlotdx) % ((xran_fs_num_slot_tdd_loop[PortId][nCellIdx] > 0) ? xran_fs_num_slot_tdd_loop[PortId][nCellIdx]: 1);
487     nSfType = xran_fs_slot_type[PortId][nCellIdx][nSfIdxMod];
488
489     if (nSfType == nType)
490     {
491         ret = 1;
492     }
493     else if (nSfType == XRAN_SLOT_TYPE_SP)
494     {
495         if ((nType == XRAN_SLOT_TYPE_DL) && xran_fs_num_dl_sym_sp[PortId][nCellIdx][nSfIdxMod])
496         {
497             ret = 1;
498         }
499
500         if ((nType == XRAN_SLOT_TYPE_UL) && xran_fs_num_ul_sym_sp[PortId][nCellIdx][nSfIdxMod])
501         {
502             ret = 1;
503         }
504     }
505     else if (nSfType == XRAN_SLOT_TYPE_FDD)
506     {
507         ret = 1;
508     }
509
510     return ret;
511 }
512
513 int32_t xran_fs_get_symbol_type(uint32_t PortId, int32_t nCellIdx, int32_t nSlotdx,  int32_t nSymbIdx)
514 {
515     int32_t nSfIdxMod;
516
517     nSfIdxMod = xran_fs_slot_limit(PortId, nSlotdx) % ((xran_fs_num_slot_tdd_loop[PortId][nCellIdx] > 0) ? xran_fs_num_slot_tdd_loop[PortId][nCellIdx]: 1);
518
519     return xran_fs_slot_symb_type[PortId][nCellIdx][nSfIdxMod][nSymbIdx];
520 }
521
522