PUSCH PDU for msg3 and UL-CCCH Ind flow completion
[o-du/l2.git] / src / 5gnrmac / mac_rach.c
index 2d5d2c8..4520aab 100644 (file)
@@ -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 */
@@ -51,14 +52,6 @@ MacSchRachIndFunc macSchRachIndOpts[]=
    packMacSchRachInd
 };
 
-/* Function pointer for sending crc ind from MAC to SCH */
-MacSchCrcIndFunc macSchCrcIndOpts[]=
-{
-   packMacSchCrcInd,
-   macSchCrcInd,
-   packMacSchCrcInd
-};
-
 /*******************************************************************
  *
  * @brief Sends RACH indication to SCH
@@ -85,33 +78,6 @@ int sendRachIndMacToSch(RachIndInfo *rachInd)
    return(*macSchRachIndOpts[pst.selector])(&pst, rachInd); 
 }
 
-/*******************************************************************
- *
- * @brief Sends CRC Indication to SCH
- *
- * @details
- *
- *    Function : sendCrcIndMacToSch 
- *
- *    Functionality:
- *       Sends CRC Indication to SCH
- *
- * @params[in] 
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-int sendCrcIndMacToSch(CrcIndInfo *crcInd)
-{
-   Pst pst;
-  
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_CRC_IND_TO_SCH;
-   return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
-}
-
 /*******************************************************************
  *
  * @brief Processes RACH indication from PHY
@@ -133,66 +99,32 @@ uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
 {
    uint8_t      pduIdx;
    uint8_t      preambleIdx;
-   RachIndInfo  *rachIndInfo;
+   RachIndInfo  rachIndInfo;
 
    DU_LOG("\nMAC : Received RACH indication");
    /* Considering one pdu and one preamble */
    pduIdx = 0;
    preambleIdx = 0;
 
-   rachIndInfo = &macCb.macCell->raCb;
-
-   rachIndInfo->cellId = rachInd->rachPdu[pduIdx].pci;
-   /* TODO : Allocate 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 = \
+   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 = \
+   rachIndInfo.timingAdv = \
       rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
 
-   return(sendRachIndMacToSch(rachIndInfo));
-}
-
-/*******************************************************************
- *
- * @brief Processes CRC Indication from PHY
- *
- * @details
- *
- *    Function : fapiMacCrcInd
- *
- *    Functionality:
- *       Processes CRC Indication from PHY
- *
- * @params[in] Post Structure Pointer
- *             Crc Indication Pointer
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
-{
-   CrcIndInfo   crcIndInfo;
+   /* storing the value in macRaCb */
+   createMacRaCb(rachIndInfo.cellId, rachIndInfo.crnti);
 
-   DU_LOG("\nMAC : Received CRC indication");
-   /* Considering one pdu and one preamble */
-   
-   crcIndInfo.cellId = macCb.macCell->cellId;;
-   crcIndInfo.crnti = crcInd->crcInfo[0].rnti;
-   crcIndInfo.timingInfo.sfn = crcInd->timingInfo.sfn;
-   crcIndInfo.timingInfo.slot = crcInd->timingInfo.slot;
-   crcIndInfo.numCrcInd = crcInd->crcInfo[0].numCb;
-   crcIndInfo.crcInd[0] = crcInd->crcInfo[0].cbCrcStatus[0];
-   
-   return(sendCrcIndMacToSch(&crcIndInfo));
+   return(sendRachIndMacToSch(&rachIndInfo));
 }
 
 /* spec-38.211 Table 6.3.3.1-7 */
 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = 
 {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
@@ -208,31 +140,6 @@ int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo)
    return ROK;
 }
 
-/*******************************************************************
- *
- * @brief Process Rx Data Ind at MAC
- *
- * @details
- *
- *    Function : fapiMacRxDataInd
- *
- *    Functionality:
- *       Process Rx Data Ind at MAC
- *
- * @params[in] Post structure
- *             Rx Data Indication
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
-{
-   DU_LOG("\nMAC : Received Rx Data indication");
-   /* TODO : Demuxing */
-   return ROK;
-}
-
-
 /**********************************************************************
   End of file
  **********************************************************************/