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 *******************************************************************************/
18 /* header include files (.h) */
19 #include "common_def.h"
20 #include "tfu.h" /* RGU Interface includes */
23 #include "tfu.x" /* RGU Interface includes */
25 #include "du_app_mac_inf.h"
29 /* Function pointer for sending rach ind from MAC to SCH */
30 MacSchRachIndFunc macSchRachIndOpts[]=
37 /*******************************************************************
39 * @brief Sends RACH indication to SCH
43 * Function : sendRachIndMacToSch
46 * Sends RACH indication to SCH
48 * @params[in] RACH indication info
49 * @return ROK - success
52 * ****************************************************************/
53 int sendRachIndMacToSch(RachIndInfo *rachInd)
57 fillMacToSchPst(&pst);
58 pst.event = EVENT_RACH_IND_TO_SCH;
60 return(*macSchRachIndOpts[pst.selector])(&pst, rachInd);
63 /*******************************************************************
65 * @brief Processes RACH indication from PHY
69 * Function : fapiMacRachInd
72 * Processes RACH indication from PHY
74 * @params[in] Post structure
75 * Rach indication message
76 * @return ROK - success
79 * ****************************************************************/
80 uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
84 RachIndInfo rachIndInfo;
86 DU_LOG("\nMAC : Received RACH indication");
87 /* Considering one pdu and one preamble */
91 rachIndInfo.cellId = rachInd->rachPdu[pduIdx].pci;
92 /* TODO : A.ocate unique crnti for each ue */
93 rachIndInfo.crnti = 100;
94 rachIndInfo.timingInfo.sfn = rachInd->timingInfo.sfn;
95 rachIndInfo.timingInfo.slot = rachInd->timingInfo.slot;
96 rachIndInfo.slotIdx = rachInd->rachPdu[pduIdx].slotIdx;
97 rachIndInfo.symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx;
98 rachIndInfo.freqIdx = rachInd->rachPdu[pduIdx].freqIdx;
99 rachIndInfo.preambleIdx = \
100 rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx;
101 rachIndInfo.timingAdv = \
102 rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
104 /* storing the value in macRaCb */
105 createMacRaCb(rachIndInfo.cellId, rachIndInfo.crnti);
107 return(sendRachIndMacToSch(&rachIndInfo));
110 /* spec-38.211 Table 6.3.3.1-7 */
111 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] =
112 {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
114 int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
116 if(ulSchedInfo != NULLP)
118 MacUlSlot *currUlSlot =
119 &macCb.macCell->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
120 memcpy(&currUlSlot->ulInfo, ulSchedInfo, sizeof(UlSchedInfo));
125 /**********************************************************************
127 **********************************************************************/