X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_rach.c;h=4520aab89931575078b8a7a8d4103383060d5158;hb=85008fef60069af4d70a447e76aaae64ce836292;hp=19faa2b42e85dae9a4da4c9dd26deb4214fe0854;hpb=9fc4986e02c1ab2be2a9276cdfbf049c55af88e6;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index 19faa2b42..4520aab89 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -28,6 +28,7 @@ #include "cm_lte.h" /* Common LTE Defines */ #include "tfu.h" /* RGU Interface includes */ #include "lrg.h" + #include "gen.x" /* general */ #include "ssi.x" /* system services */ #include "cm5.x" /* system services */ @@ -41,7 +42,88 @@ #include "lrg.x" #include "du_app_mac_inf.h" #include "mac.h" +#include "du_log.h" + +/* Function pointer for sending rach ind from MAC to SCH */ +MacSchRachIndFunc macSchRachIndOpts[]= +{ + packMacSchRachInd, + macSchRachInd, + packMacSchRachInd +}; +/******************************************************************* + * + * @brief Sends RACH indication to SCH + * + * @details + * + * Function : sendRachIndMacToSch + * + * Functionality: + * Sends RACH indication to SCH + * + * @params[in] RACH indication info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +int sendRachIndMacToSch(RachIndInfo *rachInd) +{ + Pst pst; + + fillMacToSchPst(&pst); + pst.event = EVENT_RACH_IND_TO_SCH; + + return(*macSchRachIndOpts[pst.selector])(&pst, rachInd); +} + +/******************************************************************* + * + * @brief Processes RACH indication from PHY + * + * @details + * + * Function : fapiMacRachInd + * + * Functionality: + * Processes RACH indication from PHY + * + * @params[in] Post structure + * Rach indication message + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd) +{ + uint8_t pduIdx; + uint8_t preambleIdx; + RachIndInfo rachIndInfo; + + DU_LOG("\nMAC : Received RACH indication"); + /* Considering one pdu and one preamble */ + pduIdx = 0; + preambleIdx = 0; + + rachIndInfo.cellId = rachInd->rachPdu[pduIdx].pci; + /* TODO : A.ocate unique crnti for each ue */ + rachIndInfo.crnti = 100; + rachIndInfo.timingInfo.sfn = rachInd->timingInfo.sfn; + rachIndInfo.timingInfo.slot = rachInd->timingInfo.slot; + rachIndInfo.slotIdx = rachInd->rachPdu[pduIdx].slotIdx; + rachIndInfo.symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx; + rachIndInfo.freqIdx = rachInd->rachPdu[pduIdx].freqIdx; + rachIndInfo.preambleIdx = \ + rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx; + rachIndInfo.timingAdv = \ + rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv; + + /* storing the value in macRaCb */ + createMacRaCb(rachIndInfo.cellId, rachIndInfo.crnti); + + return(sendRachIndMacToSch(&rachIndInfo)); +} /* spec-38.211 Table 6.3.3.1-7 */ uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = @@ -49,7 +131,12 @@ uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo) { - + if(ulSchInfo != NULLP) + { + MacUlSlot *currUlSlot = + &macCb.macCell->ulSlot[ulSchInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED]; + memcpy(&currUlSlot->ulCellInfo, ulSchInfo, sizeof(UlSchInfo)); + } return ROK; }