X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_rach.c;h=c2196194e0e7239874cbbef892ecd9e3c334980b;hb=e54c2aae19e97065def9e5ab2d1488477b1ea209;hp=010063100fd63b351d3a728cd12a4e3000942384;hpb=964fd8f1dc9c969e70caf8885332cc086ff22d74;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index 010063100..c2196194e 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -25,22 +25,6 @@ #include "mac.h" #include "mac_utils.h" -/* Function pointer for sending rach ind from MAC to SCH */ -MacSchRachIndFunc macSchRachIndOpts[]= -{ - packMacSchRachInd, /* packing for loosely coupled */ - MacSchRachInd, /* packing for tightly coupled */ - packMacSchRachInd /* packing for light weight loosely coupled */ -}; - -/* Function pointer for sending RACH resource request from MAC to SCH */ -MacSchRachRsrcReqFunc macSchRachRsrcReqOpts[] = -{ - packMacSchRachRsrcReq, /* packing for loosely coupled */ - MacSchRachRsrcReq, /* packing for tightly coupled */ - packMacSchRachRsrcReq /* packing for light weight loosely coupled */ -}; - /* Function pointer for sending RACH resource response from MAC to DU APP */ MacDuRachRsrcRspFunc macDuRachRsrcRspOpts[] = { @@ -49,14 +33,6 @@ MacDuRachRsrcRspFunc macDuRachRsrcRspOpts[] = packDuMacRachRsrcRsp /* packing for light weight loosly coupled */ }; -/* Function pointer for sending RACH resource release from MAC to SCH */ -MacSchRachRsrcRelFunc macSchRachRsrcRelOpts[] = -{ - packMacSchRachRsrcRel, /* packing for loosely coupled */ - MacSchRachRsrcRel, /* packing for tightly coupled */ - packMacSchRachRsrcRel /* packing for light weight loosely coupled */ -}; - /******************************************************************* * * @brief Sends RACH indication to SCH @@ -78,7 +54,7 @@ uint8_t sendRachIndMacToSch(RachIndInfo *rachInd) Pst pst; FILL_PST_MAC_TO_SCH(pst, EVENT_RACH_IND_TO_SCH); - return(*macSchRachIndOpts[pst.selector])(&pst, rachInd); + return(SchMessageRouter(&pst, (void *)rachInd)); } /******************************************************************* @@ -146,8 +122,13 @@ uint8_t createMacRaCb(MacCellCb *cellCb, RachIndInfo *rachIndInfo) GET_CRNTI(crnti, ueIdx+1); /* Store in raCb */ + memset(&cellCb->macRaCb[ueIdx], 0, sizeof(MacRaCbInfo)); cellCb->macRaCb[ueIdx].cellId = rachIndInfo->cellId; cellCb->macRaCb[ueIdx].crnti = crnti; + + /* Initialize MSG4 HARQ PROC CB */ + cellCb->macRaCb[ueIdx].msg4HqInfo.procId = MAX_NUM_HARQ_PROC; + } /* Store in Rach Indication message to be sent to SCH */ @@ -278,7 +259,7 @@ uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq) /* Send RACH resource request from MAC to SCH */ FILL_PST_MAC_TO_SCH(schPst, EVENT_RACH_RESOURCE_REQUEST_TO_SCH); - ret = (*macSchRachRsrcReqOpts[schPst.selector])(&schPst, schRachRsrcReq); + ret = SchMessageRouter(&schPst, (void *)schRachRsrcReq); } else DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource request to SCH"); @@ -445,7 +426,7 @@ uint8_t MacProcRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel) /* Send RACH resource release from MAC to SCH */ FILL_PST_MAC_TO_SCH(schPst, EVENT_RACH_RESOURCE_RELEASE_TO_SCH); - ret = (*macSchRachRsrcRelOpts[schPst.selector])(&schPst, schRachRsrcRel); + ret = SchMessageRouter(&schPst, (void *)schRachRsrcRel); } else DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource release to SCH"); @@ -493,8 +474,8 @@ uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo) if(ulSchedInfo != NULLP) { MacUlSlot *currUlSlot = - &macCb.macCell[cellIdx]->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOTS]; - memcpy(&currUlSlot->ulInfo, ulSchedInfo, sizeof(UlSchedInfo)); + &macCb.macCell[cellIdx]->ulSlot[ulSchedInfo->slotIndInfo.slot % macCb.macCell[cellIdx]->numOfSlots]; + memcpy(&currUlSlot->ulSchInfo, ulSchedInfo, sizeof(UlSchedInfo)); } return ROK; }