PHY_DELTA changes 05/4105/4
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Mon, 15 Jun 2020 15:20:40 +0000 (20:50 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Thu, 25 Jun 2020 12:19:07 +0000 (17:49 +0530)
Change-Id: I5c67a57b1f61464af776bc6af27e12d5b16ec350
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
24 files changed:
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_mux.c
src/5gnrmac/mac_rach.c
src/5gnrmac/mac_slot_ind.c
src/5gnrmac/mac_stop_ind.c
src/5gnrmac/rg_lim.c
src/5gnrmac/rg_lmm.c
src/5gnrmac/rg_tom.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_slot_ind.c
src/5gnrsch/sch_utils.c
src/5gnrsch/sch_utils.h
src/cm/common_def.h [new file with mode: 0644]
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.c
src/cm/mac_sch_interface.h
src/du_app/du_cfg.c
src/phy_stub/l1_bdy1.c

index 2e92246..96cd18e 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <stdlib.h>
 #include <stdint.h>
 
 #include <stdlib.h>
 #include <stdint.h>
+#include <stdbool.h>
 
 /* header include files -- defines (.h) */
 #include "envopt.h"        /* environment options */
 
 /* header include files -- defines (.h) */
 #include "envopt.h"        /* environment options */
@@ -62,6 +63,7 @@
 #include "mac.h"
 #include "rg.x"            /* typedefs for MAC */
 #include "lwr_mac_phy.h"
 #include "mac.h"
 #include "rg.x"            /* typedefs for MAC */
 #include "lwr_mac_phy.h"
+#include "common_def.h"
 #include "math.h"
 
 #define MIB_SFN_BITMASK 0xFC
 #include "math.h"
 
 #define MIB_SFN_BITMASK 0xFC
@@ -78,7 +80,7 @@ extern uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX];
 
 /* Global variables */
 uint8_t slotIndIdx;
 
 /* Global variables */
 uint8_t slotIndIdx;
-uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo);
+uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo);
 
 void lwrMacInit()
 {
 
 void lwrMacInit()
 {
@@ -2714,27 +2716,35 @@ Msg4Info *msg4Info)
  * @return ROK
  *
  ******************************************************************/
  * @return ROK
  *
  ******************************************************************/
-
-S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlAlloc *dlAlloc, uint32_t *msgLen, RntiType rntiType)
+S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, uint32_t *msgLen, RntiType rntiType)
 {
    if(dlTtiReqPdu != NULLP)
    {
       PdcchCfg *pdcchInfo = NULLP;
 {
    if(dlTtiReqPdu != NULLP)
    {
       PdcchCfg *pdcchInfo = NULLP;
+      BwpCfg *bwp = NULLP;
+
+      dlTtiReqPdu->u.pdcch_pdu.dlDci = (fapi_dl_dci_t *)(dlTtiReqPdu + \
+         (sizeof(fapi_dl_tti_req_pdu_t) - sizeof(dlTtiReqPdu->u)) + \
+         (sizeof(fapi_dl_pdcch_pdu_t) - sizeof(fapi_dl_dci_t*)));
+
       if(rntiType == SI_RNTI_TYPE)
       {
       if(rntiType == SI_RNTI_TYPE)
       {
-         pdcchInfo = &dlAlloc->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
+         pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
+         bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp;
          fillSib1DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == RA_RNTI_TYPE)
       {
          fillSib1DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == RA_RNTI_TYPE)
       {
-         pdcchInfo = &dlAlloc->rarAlloc.rarPdcchCfg;
+         pdcchInfo = &dlInfo->rarAlloc->rarPdcchCfg;
+         bwp = &dlInfo->rarAlloc->bwp;
          fillRarDlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == TC_RNTI_TYPE)
       {
          fillRarDlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == TC_RNTI_TYPE)
       {
-         pdcchInfo = &dlAlloc->msg4Alloc->msg4PdcchCfg;
+         pdcchInfo = &dlInfo->msg4Alloc->msg4PdcchCfg;
+         bwp = &dlInfo->msg4Alloc->bwp;
          fillMsg4DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo,\
          fillMsg4DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo,\
-            &dlAlloc->msg4Alloc->msg4Info);
+            &dlInfo->msg4Alloc->msg4Info);
       }
       else
       {
       }
       else
       {
@@ -2742,10 +2752,10 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlAlloc *dlAlloc, uint32_t
          return RFAILED;;
       }
       dlTtiReqPdu->pduType = PDCCH_PDU_TYPE;
          return RFAILED;;
       }
       dlTtiReqPdu->pduType = PDCCH_PDU_TYPE;
-      dlTtiReqPdu->u.pdcch_pdu.bwpSize = pdcchInfo->pdcchBwpCfg.BWPSize;
-      dlTtiReqPdu->u.pdcch_pdu.bwpPart = pdcchInfo->pdcchBwpCfg.BWPStart;
-      dlTtiReqPdu->u.pdcch_pdu.subCarrierSpacing = pdcchInfo->pdcchBwpCfg.subcarrierSpacing; 
-      dlTtiReqPdu->u.pdcch_pdu.cyclicPrefix = pdcchInfo->pdcchBwpCfg.cyclicPrefix; 
+      dlTtiReqPdu->u.pdcch_pdu.bwpSize = bwp->BWPSize;
+      dlTtiReqPdu->u.pdcch_pdu.bwpPart = bwp->BWPStart;
+      dlTtiReqPdu->u.pdcch_pdu.subCarrierSpacing = bwp->subcarrierSpacing; 
+      dlTtiReqPdu->u.pdcch_pdu.cyclicPrefix = bwp->cyclicPrefix; 
       dlTtiReqPdu->u.pdcch_pdu.startSymbolIndex = pdcchInfo->coreset0Cfg.startSymbolIndex;
       dlTtiReqPdu->u.pdcch_pdu.durationSymbols = pdcchInfo->coreset0Cfg.durationSymbols;
       memcpy(dlTtiReqPdu->u.pdcch_pdu.freqDomainResource, pdcchInfo->coreset0Cfg.freqDomainResource, 6);
       dlTtiReqPdu->u.pdcch_pdu.startSymbolIndex = pdcchInfo->coreset0Cfg.startSymbolIndex;
       dlTtiReqPdu->u.pdcch_pdu.durationSymbols = pdcchInfo->coreset0Cfg.durationSymbols;
       memcpy(dlTtiReqPdu->u.pdcch_pdu.freqDomainResource, pdcchInfo->coreset0Cfg.freqDomainResource, 6);
@@ -2756,9 +2766,6 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlAlloc *dlAlloc, uint32_t
       dlTtiReqPdu->u.pdcch_pdu.shiftIndex =  pdcchInfo->coreset0Cfg.shiftIndex;
       dlTtiReqPdu->u.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity;
       dlTtiReqPdu->u.pdcch_pdu.numDlDci = pdcchInfo->numDlDci;
       dlTtiReqPdu->u.pdcch_pdu.shiftIndex =  pdcchInfo->coreset0Cfg.shiftIndex;
       dlTtiReqPdu->u.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity;
       dlTtiReqPdu->u.pdcch_pdu.numDlDci = pdcchInfo->numDlDci;
-      dlTtiReqPdu->u.pdcch_pdu.dlDci = (fapi_dl_dci_t *)(dlTtiReqPdu + \
-         (sizeof(fapi_dl_tti_req_pdu_t) - sizeof(dlTtiReqPdu->u)) + \
-         (sizeof(fapi_dl_pdcch_pdu_t) - sizeof(fapi_dl_dci_t*)));
 
       /* Calculating PDU length. Considering only one dl dci pdu for now */
       dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t) + sizeof(fapi_dl_dci_t);
 
       /* Calculating PDU length. Considering only one dl dci pdu for now */
       dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t) + sizeof(fapi_dl_dci_t);
@@ -2766,8 +2773,8 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlAlloc *dlAlloc, uint32_t
          sizeof(dlTtiReqPdu->pduSize) + dlTtiReqPdu->pduSize));
 
     }
          sizeof(dlTtiReqPdu->pduSize) + dlTtiReqPdu->pduSize));
 
     }
-    return ROK;
 
 
+    return ROK;
 }
 
 /*******************************************************************
 }
 
 /*******************************************************************
@@ -2790,7 +2797,7 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlAlloc *dlAlloc, uint32_t
  ******************************************************************/
 
 void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, PdschCfg *pdschInfo,
  ******************************************************************/
 
 void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, PdschCfg *pdschInfo,
-uint32_t *msgLen, uint16_t pduIndex)
+   BwpCfg bwp,uint32_t *msgLen, uint16_t pduIndex)
 {
     uint8_t idx;
 
 {
     uint8_t idx;
 
@@ -2800,10 +2807,10 @@ uint32_t *msgLen, uint16_t pduIndex)
        dlTtiReqPdu->u.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
        dlTtiReqPdu->u.pdsch_pdu.rnti = pdschInfo->rnti;         
        dlTtiReqPdu->u.pdsch_pdu.pduIndex = pduIndex;
        dlTtiReqPdu->u.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
        dlTtiReqPdu->u.pdsch_pdu.rnti = pdschInfo->rnti;         
        dlTtiReqPdu->u.pdsch_pdu.pduIndex = pduIndex;
-       dlTtiReqPdu->u.pdsch_pdu.bwpSize = pdschInfo->pdschBwpCfg.BWPSize;       
-       dlTtiReqPdu->u.pdsch_pdu.bwpStart = pdschInfo->pdschBwpCfg.BWPStart;
-       dlTtiReqPdu->u.pdsch_pdu.subCarrierSpacing = pdschInfo->pdschBwpCfg.subcarrierSpacing;
-       dlTtiReqPdu->u.pdsch_pdu.cyclicPrefix = pdschInfo->pdschBwpCfg.cyclicPrefix;
+       dlTtiReqPdu->u.pdsch_pdu.bwpSize = bwp.BWPSize;       
+       dlTtiReqPdu->u.pdsch_pdu.bwpStart = bwp.BWPStart;
+       dlTtiReqPdu->u.pdsch_pdu.subCarrierSpacing = bwp.subcarrierSpacing;
+       dlTtiReqPdu->u.pdsch_pdu.cyclicPrefix = bwp.cyclicPrefix;
        dlTtiReqPdu->u.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords;
        for(idx = 0; idx < MAX_CODEWORDS ; idx++)
        { 
        dlTtiReqPdu->u.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords;
        for(idx = 0; idx < MAX_CODEWORDS ; idx++)
        { 
@@ -2864,7 +2871,7 @@ uint32_t *msgLen, uint16_t pduIndex)
  * @return count
  *
  * ********************************************************************/
  * @return count
  *
  * ********************************************************************/
-uint8_t calcDlTtiReqPduCount(DlAlloc *dlInfo)
+uint8_t calcDlTtiReqPduCount(DlSchedInfo *dlInfo)
 {
    uint8_t count = 0;
    uint8_t idx = 0;
 {
    uint8_t count = 0;
    uint8_t idx = 0;
@@ -2875,20 +2882,24 @@ uint8_t calcDlTtiReqPduCount(DlAlloc *dlInfo)
       {
          for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
          {
       {
          for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
          {
+            /* SSB PDU is filled */
             count++;
          }
       }
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
             count++;
          }
       }
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
+         /* PDCCH and PDSCH PDU is filled */
          count += 2;
       }
    }
          count += 2;
       }
    }
-   if(dlInfo->isRarPres)
+   if(dlInfo->rarAlloc != NULLP)
    {
    {
+      /* PDCCH and PDSCH PDU is filled */
       count += 2;
    }
       count += 2;
    }
-   if(dlInfo->msg4Alloc)
+   if(dlInfo->msg4Alloc != NULLP)
    {
    {
+      /* PDCCH and PDSCH PDU is filled */
       count += 2;
    }
 
       count += 2;
    }
 
@@ -2910,7 +2921,7 @@ uint8_t calcDlTtiReqPduCount(DlAlloc *dlInfo)
  * @return count
  *
  * ********************************************************************/
  * @return count
  *
  * ********************************************************************/
-uint8_t calcTxDataReqPduCount(DlAlloc *dlInfo)
+uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo)
 {
    uint8_t count = 0;
 
 {
    uint8_t count = 0;
 
@@ -2918,11 +2929,11 @@ uint8_t calcTxDataReqPduCount(DlAlloc *dlInfo)
    {
       count++;
    }
    {
       count++;
    }
-   if(dlInfo->isRarPres)
+   if(dlInfo->rarAlloc != NULLP)
    {
       count++;
    }
    {
       count++;
    }
-   if(dlInfo->msg4Alloc)
+   if(dlInfo->msg4Alloc != NULLP)
    {
       count++;
    }
    {
       count++;
    }
@@ -3109,7 +3120,7 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info,
  *         RFAILED - failure
  *
  * ****************************************************************/
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo)
+uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef FAPI
    uint8_t idx;
 {
 #ifdef FAPI
    uint8_t idx;
@@ -3118,7 +3129,10 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo)
    uint16_t pduIndex = 0;
    uint32_t msgLen = 0;
    uint32_t dlTtiReqMsgSize = 0;
    uint16_t pduIndex = 0;
    uint32_t msgLen = 0;
    uint32_t dlTtiReqMsgSize = 0;
+
    fapi_dl_tti_req_t *dlTtiReq = NULLP;
    fapi_dl_tti_req_t *dlTtiReq = NULLP;
+   SlotIndInfo dlTtiReqTimingInfo;
+
    RgCellCb  *cellCbParams = NULLP;
    MacDlSlot *currDlSlot = NULLP;
    MacCellCfg macCellCfg;
    RgCellCb  *cellCbParams = NULLP;
    MacDlSlot *currDlSlot = NULLP;
    MacCellCfg macCellCfg;
@@ -3128,154 +3142,153 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo)
    
    if(clGlobalCp.phyState == PHY_STATE_RUNNING)
    {
    
    if(clGlobalCp.phyState == PHY_STATE_RUNNING)
    {
+      /* consider phy delay */
+      ADD_DELTA_TO_TIME(currTimingInfo,dlTtiReqTimingInfo,PHY_DELTA);
+
       cellCbParams = rgCb[inst].cell;
       cellCbParams = rgCb[inst].cell;
-      macCellCfg = cellCbParams->macCellCfg;
-   
-      if(currTimingInfo != NULLP)
-      {
-         currDlSlot = &macCb.macCell->dlSlot[currTimingInfo->slot % MAX_SLOT_SUPPORTED]; 
-         nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo);
-         dlTtiReqMsgSize = sizeof(fapi_dl_tti_req_t) + (nPdu * \
-            sizeof(fapi_dl_tti_req_pdu_t));
-         if(nPdu > 0)
-         {
-            if(currDlSlot->dlInfo.isBroadcastPres)
-            {
-               if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-               {
-                  dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
-               }
-   
-            }
-            if(currDlSlot->dlInfo.isRarPres)
-            {
-               dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
-            }
-            if(currDlSlot->dlInfo.msg4Alloc)
-            {
-               dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
-            }
-         }
-         LWR_MAC_ALLOC(dlTtiReq, dlTtiReqMsgSize);
-         if(dlTtiReq != NULLP)
-         {
-            memset(dlTtiReq, 0, dlTtiReqMsgSize);
-            dlTtiReq->sfn = currTimingInfo->sfn;
-            dlTtiReq->slot = currTimingInfo->slot;
-            dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
-            nPdu = dlTtiReq->nPdus;
-            dlTtiReq->nGroup = 0;
-            if(dlTtiReq->nPdus > 0)
-            {
-               dlTtiReq->pdus = (fapi_dl_tti_req_pdu_t*)(dlTtiReq + \
-                 (sizeof(fapi_dl_tti_req_t) - sizeof(fapi_dl_tti_req_pdu_t*)));
-               if(!dlTtiReq->pdus)
-               {
-                  DU_LOG("\nLWR_MAC: Memory allocation failed");
-                  return RFAILED;
-               }
-               
-               if(currDlSlot->dlInfo.isBroadcastPres)
-               {
-                  if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
-                  {
-                     if(dlTtiReq->pdus != NULLP)
-                     {
-                        for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
-                        {
-                           fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
-                           currDlSlot, &msgLen, idx, dlTtiReq->sfn);
-                           numPduEncoded++;
-                        }
-                     }
-                     printf("\033[1;31m");
-                     DU_LOG("\nLWR_MAC: MIB sent..");
-                     printf("\033[0m");
-                  }
-                  if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-                  {
-                     /* Filling SIB1 param */
-                     if(numPduEncoded != nPdu)
-                     {
-                        rntiType = SI_RNTI_TYPE;
-                        fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
-                        &msgLen, rntiType);
-                        numPduEncoded++;
-                        fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo.brdcstAlloc.\
-                        sib1Alloc.sib1PdschCfg, &msgLen, pduIndex);
-                        pduIndex++;
-                        numPduEncoded++;
-                     }
-                     printf("\033[1;34m");
-                     DU_LOG("\nLWR_MAC: SIB1 sent...");
-                     printf("\033[0m");
-                  }
-               }
-               if(currDlSlot->dlInfo.isRarPres)
-               {
-                  /* Filling RAR param */
-                  rntiType = RA_RNTI_TYPE;
-                  fillRarPdu(&currDlSlot->dlInfo.rarAlloc.rarInfo);
-                  fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                     &currDlSlot->dlInfo, &msgLen, rntiType);
-                  numPduEncoded++;
-                  fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], \
-                     &currDlSlot->dlInfo.rarAlloc.rarPdschCfg, &msgLen, pduIndex);
-                  numPduEncoded++;
-                  pduIndex++;
-                  
-                  printf("\033[1;32m");
-                  DU_LOG("\nLWR_MAC: RAR sent...");
-                  printf("\033[0m");
-               }
-               if(currDlSlot->dlInfo.msg4Alloc)
-               {
-                  /* Filling Msg4 param */
-                  rntiType = TC_RNTI_TYPE;
-                  fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                   &currDlSlot->dlInfo, &msgLen, rntiType);
-                  numPduEncoded++;
-                  fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], \
-                   &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg, &msgLen, pduIndex);
-                  numPduEncoded++;
-                  pduIndex++;
-
-                  printf("\033[1;32m");
-                  DU_LOG("\nLWR_MAC: MSG4 sent...");
-                  printf("\033[0m");
-               }
-               msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
-               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
-               LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, \
-               (void *)dlTtiReq);
-               
-               /* send Tx-DATA req message */
-               sendTxDataReq(currTimingInfo, &currDlSlot->dlInfo);
-            }
-            else
-            {
-               msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
-               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
-               LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, (void *)dlTtiReq);
-            }
-            return ROK;
-         }
-         else
-         {
-            DU_LOG("\nLWR_MAC: Failed to allocate memory for DL TTI Request");
-            return RFAILED;
-         }
-      }
-      else
-      {
-         DU_LOG("\nLWR_MAC: Current TTI Info is NULL");
-         return RFAILED;
-      }
-   }
+               macCellCfg = cellCbParams->macCellCfg;
+
+               currDlSlot = &macCb.macCell->dlSlot[dlTtiReqTimingInfo.slot]; 
+               nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo);
+               dlTtiReqMsgSize = sizeof(fapi_dl_tti_req_t) + (nPdu * \
+                               sizeof(fapi_dl_tti_req_pdu_t));
+               if(nPdu > 0)
+               {
+                       if(currDlSlot->dlInfo.isBroadcastPres)
+                       {
+                               if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
+                               {
+                                       dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
+                               }
+                       }
+                       if(currDlSlot->dlInfo.rarAlloc != NULLP)
+                       {
+                               dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
+                       }
+                       if(currDlSlot->dlInfo.msg4Alloc != NULLP)
+                       {
+                               dlTtiReqMsgSize += sizeof(fapi_dl_dci_t);
+                       }
+               }
+               LWR_MAC_ALLOC(dlTtiReq, dlTtiReqMsgSize);
+               if(dlTtiReq != NULLP)
+               {
+                       memset(dlTtiReq, 0, dlTtiReqMsgSize);
+                       dlTtiReq->sfn  = dlTtiReqTimingInfo.sfn;
+                       dlTtiReq->slot = dlTtiReqTimingInfo.slot;
+                       dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
+                       nPdu = dlTtiReq->nPdus;
+                       dlTtiReq->nGroup = 0;
+
+                       if(dlTtiReq->nPdus > 0)
+                       {
+                               dlTtiReq->pdus = (fapi_dl_tti_req_pdu_t*)(dlTtiReq + \
+                                               (sizeof(fapi_dl_tti_req_t) - sizeof(fapi_dl_tti_req_pdu_t*)));
+                               if(!dlTtiReq->pdus)
+                               {
+                                       DU_LOG("\nLWR_MAC: Memory allocation failed");
+                                       return RFAILED;
+                               }
+
+                               if(currDlSlot->dlInfo.isBroadcastPres)
+                               {
+                                       if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
+                                       {
+                                               if(dlTtiReq->pdus != NULLP)
+                                               {
+                                                       for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
+                                                       {
+                                                               fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
+                                                                               currDlSlot, &msgLen, idx, dlTtiReq->sfn);
+                                                               numPduEncoded++;
+                                                       }
+                                               }
+                                               printf("\033[1;31m");
+                                               DU_LOG("\nLWR_MAC: MIB sent..");
+                                               printf("\033[0m");
+                                       }
+                                       if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
+                                       {
+                                               /* Filling SIB1 param */
+                                               if(numPduEncoded != nPdu)
+                                               {
+                                                       rntiType = SI_RNTI_TYPE;
+                                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
+                                                                       &msgLen, rntiType);
+                                                       numPduEncoded++;
+                                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                                                                       &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
+                                                                       currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
+                                                                       &msgLen, pduIndex);
+                                                       pduIndex++;
+                                                       numPduEncoded++;
+                                               }
+                                               printf("\033[1;34m");
+                                               DU_LOG("\nLWR_MAC: SIB1 sent...");
+                                               printf("\033[0m");
+                                       }
+                               }
+                               if(currDlSlot->dlInfo.rarAlloc != NULLP)
+                               {
+                                       /* Filling RAR param */
+                                       rntiType = RA_RNTI_TYPE;
+                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                                                       &currDlSlot->dlInfo, &msgLen, rntiType);
+                                       numPduEncoded++;
+                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                                                       &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
+                                                       currDlSlot->dlInfo.rarAlloc->bwp,
+                                                       &msgLen, pduIndex);
+                                       numPduEncoded++;
+                                       pduIndex++;
+
+                                       printf("\033[1;32m");
+                                       DU_LOG("\nLWR_MAC: RAR sent...");
+                                       printf("\033[0m");
+                               }
+                               if(currDlSlot->dlInfo.msg4Alloc != NULLP)
+                               {
+                                       /* Filling Msg4 param */
+                                       rntiType = TC_RNTI_TYPE;
+                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                                                       &currDlSlot->dlInfo, &msgLen, rntiType);
+                                       numPduEncoded++;
+                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                                                       &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg,
+                                                       currDlSlot->dlInfo.msg4Alloc->bwp,
+                                                       &msgLen, pduIndex);
+                                       numPduEncoded++;
+                                       pduIndex++;
+
+                                       printf("\033[1;32m");
+                                       DU_LOG("\nLWR_MAC: MSG4 sent...");
+                                       printf("\033[0m");
+                               }
+                               msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
+                               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
+                               LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, \
+                                               (void *)dlTtiReq);
+
+                               /* send Tx-DATA req message */
+                               sendTxDataReq(currTimingInfo, &currDlSlot->dlInfo);
+                       }
+                       else
+                       {
+                               msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
+                               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
+                               LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, (void *)dlTtiReq);
+                       }
+                       return ROK;
+               }
+               else
+               {
+                       DU_LOG("\nLWR_MAC: Failed to allocate memory for DL TTI Request");
+                       return RFAILED;
+               }
+       }
    else
    {
    else
    {
-       lwr_mac_handleInvalidEvt(currTimingInfo);
+       lwr_mac_handleInvalidEvt(&currTimingInfo);
        return RFAILED;
    }
 #endif
        return RFAILED;
    }
 #endif
@@ -3298,7 +3311,7 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo)
+uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo)
 {
 #ifdef FAPI
    uint8_t nPdu = 0;
 {
 #ifdef FAPI
    uint8_t nPdu = 0;
@@ -3318,11 +3331,11 @@ uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo)
       {
          txDataReqMsgSize += rgCb[inst].cell->macCellCfg.sib1Cfg.sib1PduLen;
       }
       {
          txDataReqMsgSize += rgCb[inst].cell->macCellCfg.sib1Cfg.sib1PduLen;
       }
-      if(dlInfo->isRarPres)
+      if(dlInfo->rarAlloc != NULLP)
       {
       {
-         txDataReqMsgSize += dlInfo->rarAlloc.rarInfo.rarPduLen;
+         txDataReqMsgSize += dlInfo->rarAlloc->rarInfo.rarPduLen;
       }
       }
-      if(dlInfo->msg4Alloc)
+      if(dlInfo->msg4Alloc != NULLP)
       {
          txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen;
       }
       {
          txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen;
       }
@@ -3335,8 +3348,8 @@ uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo)
       }
 
       memset(txDataReq, 0, txDataReqMsgSize);
       }
 
       memset(txDataReq, 0, txDataReqMsgSize);
-      txDataReq->sfn = currTimingInfo->sfn;
-      txDataReq->slot = currTimingInfo->slot;
+               txDataReq->sfn  = currTimingInfo.sfn;
+               txDataReq->slot = currTimingInfo.slot;
       txDataReq->pduDesc = (fapi_tx_pdu_desc_t *)(txDataReq + \
          (sizeof(fapi_tx_data_req_t) - sizeof(fapi_tx_pdu_desc_t *)));
 
       txDataReq->pduDesc = (fapi_tx_pdu_desc_t *)(txDataReq + \
          (sizeof(fapi_tx_data_req_t) - sizeof(fapi_tx_pdu_desc_t *)));
 
@@ -3347,19 +3360,24 @@ uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo)
          pduIndex++;
          txDataReq->numPdus++;
       }
          pduIndex++;
          txDataReq->numPdus++;
       }
-      if(dlInfo->isRarPres)
+      if(dlInfo->rarAlloc != NULLP)
       {
       {
-         fillRarTxDataReq(txDataReq->pduDesc, &dlInfo->rarAlloc.\
-            rarInfo, &msgLen, pduIndex);
+         fillRarTxDataReq(txDataReq->pduDesc, &dlInfo->rarAlloc->rarInfo, &msgLen, pduIndex);
          pduIndex++;
          txDataReq->numPdus++;
          pduIndex++;
          txDataReq->numPdus++;
+
+         MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
+         dlInfo->rarAlloc = NULLP;
       }
       }
-      if(dlInfo->msg4Alloc)
+      if(dlInfo->msg4Alloc != NULLP)
       {
          fillMsg4TxDataReq(txDataReq->pduDesc, &dlInfo->msg4Alloc->\
              msg4Info, &msgLen, pduIndex);
          pduIndex++;
          txDataReq->numPdus++;
       {
          fillMsg4TxDataReq(txDataReq->pduDesc, &dlInfo->msg4Alloc->\
              msg4Info, &msgLen, pduIndex);
          pduIndex++;
          txDataReq->numPdus++;
+
+         MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc));
+         dlInfo->msg4Alloc = NULLP;
       }
       msgLen += sizeof(fapi_tx_data_req_t) - sizeof(fapi_msg_t);
       fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
       }
       msgLen += sizeof(fapi_tx_data_req_t) - sizeof(fapi_msg_t);
       fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
@@ -3392,31 +3410,31 @@ uint8_t getnPdus(fapi_ul_tti_req_t *ulTtiReq, MacUlSlot *currUlSlot)
 
    if(currUlSlot != NULLP)
    {
 
    if(currUlSlot != NULLP)
    {
-      if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PRACH)
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
       {
          pduCount++;
          if(ulTtiReq)
             ulTtiReq->rachPresent = PDU_PRESENT;
       }
       {
          pduCount++;
          if(ulTtiReq)
             ulTtiReq->rachPresent = PDU_PRESENT;
       }
-               if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PUSCH)
+               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
                {
                   pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlsch++;
                }
                {
                   pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlsch++;
                }
-               if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PUSCH_UCI)
+               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH_UCI)
                {
                   pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlsch = PDU_PRESENT;
       }
                {
                   pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlsch = PDU_PRESENT;
       }
-      if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_UCI)
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
       {
          pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlcch = PDU_PRESENT;
       }
       {
          pduCount++;
          if(ulTtiReq)
             ulTtiReq->nUlcch = PDU_PRESENT;
       }
-      if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_SRS)
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS)
       {
          pduCount++;
       }
       {
          pduCount++;
       }
@@ -3476,12 +3494,12 @@ void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
    {
       ulTtiReqPdu->pduType = PRACH_PDU_TYPE; 
       ulTtiReqPdu->u.prach_pdu.physCellId = macCellCfg->phyCellId;
    {
       ulTtiReqPdu->pduType = PRACH_PDU_TYPE; 
       ulTtiReqPdu->u.prach_pdu.physCellId = macCellCfg->phyCellId;
-      ulTtiReqPdu->u.prach_pdu.numPrachOcas = currUlSlot->ulCellInfo.prachSchInfo.numPrachOcas;
+      ulTtiReqPdu->u.prach_pdu.numPrachOcas = currUlSlot->ulInfo.prachSchInfo.numPrachOcas;
       ulTtiReqPdu->u.prach_pdu.prachFormat = \
       ulTtiReqPdu->u.prach_pdu.prachFormat = \
-      currUlSlot->ulCellInfo.prachSchInfo.prachFormat;
-      ulTtiReqPdu->u.prach_pdu.numRa = currUlSlot->ulCellInfo.prachSchInfo.numRa;
+      currUlSlot->ulInfo.prachSchInfo.prachFormat;
+      ulTtiReqPdu->u.prach_pdu.numRa = currUlSlot->ulInfo.prachSchInfo.numRa;
       ulTtiReqPdu->u.prach_pdu.prachStartSymbol = \
       ulTtiReqPdu->u.prach_pdu.prachStartSymbol = \
-      currUlSlot->ulCellInfo.prachSchInfo.prachStartSymb;
+      currUlSlot->ulInfo.prachSchInfo.prachStartSymb;
       setNumCs(&ulTtiReqPdu->u.prach_pdu.numCs, macCellCfg);
       ulTtiReqPdu->u.prach_pdu.beamforming.numPrgs = 0;
       ulTtiReqPdu->u.prach_pdu.beamforming.prgSize = 0;
       setNumCs(&ulTtiReqPdu->u.prach_pdu.numCs, macCellCfg);
       ulTtiReqPdu->u.prach_pdu.beamforming.numPrgs = 0;
       ulTtiReqPdu->u.prach_pdu.beamforming.prgSize = 0;
@@ -3501,7 +3519,7 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
    {
       ulTtiReqPdu->pduType = PUSCH_PDU_TYPE;
       ulTtiReqPdu->u.pusch_pdu.pduBitMap = 1;
    {
       ulTtiReqPdu->pduType = PUSCH_PDU_TYPE;
       ulTtiReqPdu->u.pusch_pdu.pduBitMap = 1;
-      ulTtiReqPdu->u.pusch_pdu.rnti = currUlSlot->ulCellInfo.crnti;
+      ulTtiReqPdu->u.pusch_pdu.rnti = currUlSlot->ulInfo.crnti;
                /* TODO : Fill handle in raCb when scheduling pusch and access here */
       ulTtiReqPdu->u.pusch_pdu.handle = 100;
       ulTtiReqPdu->u.pusch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb;
                /* TODO : Fill handle in raCb when scheduling pusch and access here */
       ulTtiReqPdu->u.pusch_pdu.handle = 100;
       ulTtiReqPdu->u.pusch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb;
@@ -3513,39 +3531,39 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
       ulTtiReqPdu->u.pusch_pdu.targetCodeRate = 308;
       ulTtiReqPdu->u.pusch_pdu.qamModOrder = 2;
       ulTtiReqPdu->u.pusch_pdu.mcsIndex = \
       ulTtiReqPdu->u.pusch_pdu.targetCodeRate = 308;
       ulTtiReqPdu->u.pusch_pdu.qamModOrder = 2;
       ulTtiReqPdu->u.pusch_pdu.mcsIndex = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tbInfo.mcs;
+                  currUlSlot->ulInfo.schPuschInfo.tbInfo.mcs;
       ulTtiReqPdu->u.pusch_pdu.mcsTable = 0;
       ulTtiReqPdu->u.pusch_pdu.transformPrecoding = 1;
       ulTtiReqPdu->u.pusch_pdu.mcsTable = 0;
       ulTtiReqPdu->u.pusch_pdu.transformPrecoding = 1;
-      ulTtiReqPdu->u.pusch_pdu.dataScramblingId = currUlSlot->ulCellInfo.cellId;
+      ulTtiReqPdu->u.pusch_pdu.dataScramblingId = currUlSlot->ulInfo.cellId;
       ulTtiReqPdu->u.pusch_pdu.nrOfLayers = 1;
       ulTtiReqPdu->u.pusch_pdu.ulDmrsSymbPos = 4;
       ulTtiReqPdu->u.pusch_pdu.dmrsConfigType = 0;
       ulTtiReqPdu->u.pusch_pdu.nrOfLayers = 1;
       ulTtiReqPdu->u.pusch_pdu.ulDmrsSymbPos = 4;
       ulTtiReqPdu->u.pusch_pdu.dmrsConfigType = 0;
-      ulTtiReqPdu->u.pusch_pdu.ulDmrsScramblingId = currUlSlot->ulCellInfo.cellId;
+      ulTtiReqPdu->u.pusch_pdu.ulDmrsScramblingId = currUlSlot->ulInfo.cellId;
       ulTtiReqPdu->u.pusch_pdu.scid = 0;
       ulTtiReqPdu->u.pusch_pdu.numDmrsCdmGrpsNoData = 1;
       ulTtiReqPdu->u.pusch_pdu.dmrsPorts = 0;
       ulTtiReqPdu->u.pusch_pdu.resourceAlloc = \
       ulTtiReqPdu->u.pusch_pdu.scid = 0;
       ulTtiReqPdu->u.pusch_pdu.numDmrsCdmGrpsNoData = 1;
       ulTtiReqPdu->u.pusch_pdu.dmrsPorts = 0;
       ulTtiReqPdu->u.pusch_pdu.resourceAlloc = \
-                  currUlSlot->ulCellInfo.schPuschInfo.resAllocType;
+                  currUlSlot->ulInfo.schPuschInfo.resAllocType;
       ulTtiReqPdu->u.pusch_pdu.rbStart = \
       ulTtiReqPdu->u.pusch_pdu.rbStart = \
-                  currUlSlot->ulCellInfo.schPuschInfo.fdAlloc.startPrb;
+                  currUlSlot->ulInfo.schPuschInfo.fdAlloc.startPrb;
       ulTtiReqPdu->u.pusch_pdu.rbSize = \
       ulTtiReqPdu->u.pusch_pdu.rbSize = \
-                  currUlSlot->ulCellInfo.schPuschInfo.fdAlloc.numPrb;
+                  currUlSlot->ulInfo.schPuschInfo.fdAlloc.numPrb;
       ulTtiReqPdu->u.pusch_pdu.vrbToPrbMapping = 0;
       ulTtiReqPdu->u.pusch_pdu.frequencyHopping = 0;
       ulTtiReqPdu->u.pusch_pdu.txDirectCurrentLocation = 0;
       ulTtiReqPdu->u.pusch_pdu.uplinkFrequencyShift7p5khz = 0;
       ulTtiReqPdu->u.pusch_pdu.startSymbIndex = \
       ulTtiReqPdu->u.pusch_pdu.vrbToPrbMapping = 0;
       ulTtiReqPdu->u.pusch_pdu.frequencyHopping = 0;
       ulTtiReqPdu->u.pusch_pdu.txDirectCurrentLocation = 0;
       ulTtiReqPdu->u.pusch_pdu.uplinkFrequencyShift7p5khz = 0;
       ulTtiReqPdu->u.pusch_pdu.startSymbIndex = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tdAlloc.startSymb;
+                  currUlSlot->ulInfo.schPuschInfo.tdAlloc.startSymb;
       ulTtiReqPdu->u.pusch_pdu.nrOfSymbols = \
       ulTtiReqPdu->u.pusch_pdu.nrOfSymbols = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tdAlloc.numSymb;
+                  currUlSlot->ulInfo.schPuschInfo.tdAlloc.numSymb;
       ulTtiReqPdu->u.pusch_pdu.puschData.rvIndex = \
       ulTtiReqPdu->u.pusch_pdu.puschData.rvIndex = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tbInfo.rv;
+                  currUlSlot->ulInfo.schPuschInfo.tbInfo.rv;
       ulTtiReqPdu->u.pusch_pdu.puschData.harqProcessId = \
       ulTtiReqPdu->u.pusch_pdu.puschData.harqProcessId = \
-                  currUlSlot->ulCellInfo.schPuschInfo.harqProcId;
+                  currUlSlot->ulInfo.schPuschInfo.harqProcId;
       ulTtiReqPdu->u.pusch_pdu.puschData.newDataIndicator = \
       ulTtiReqPdu->u.pusch_pdu.puschData.newDataIndicator = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tbInfo.ndi;
+                  currUlSlot->ulInfo.schPuschInfo.tbInfo.ndi;
       ulTtiReqPdu->u.pusch_pdu.puschData.tbSize = \
       ulTtiReqPdu->u.pusch_pdu.puschData.tbSize = \
-                  currUlSlot->ulCellInfo.schPuschInfo.tbInfo.tbSize;
+                  currUlSlot->ulInfo.schPuschInfo.tbInfo.tbSize;
                /* numCb is 0 for new transmission */
       ulTtiReqPdu->u.pusch_pdu.puschData.numCb = 0;
 
                /* numCb is 0 for new transmission */
       ulTtiReqPdu->u.pusch_pdu.puschData.numCb = 0;
 
@@ -3573,7 +3591,7 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
  *         RFAILED - failure
  *
  ******************************************************************/
  *         RFAILED - failure
  *
  ******************************************************************/
-uint16_t handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
+uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef FAPI
    uint8_t    pduIdx = -1;
 {
 #ifdef FAPI
    uint8_t    pduIdx = -1;
@@ -3582,86 +3600,82 @@ uint16_t handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
    uint32_t   msgSize = 0;
 
    fapi_ul_tti_req_t *ulTtiReq = NULLP;
    uint32_t   msgSize = 0;
 
    fapi_ul_tti_req_t *ulTtiReq = NULLP;
+   SlotIndInfo ulTtiReqTimingInfo;
+
    RgCellCb  *cellCbParams = NULLP;
    MacUlSlot *currUlSlot = NULLP;
    MacCellCfg macCellCfg;
    Inst inst = 0;
 
    if(clGlobalCp.phyState == PHY_STATE_RUNNING)
    RgCellCb  *cellCbParams = NULLP;
    MacUlSlot *currUlSlot = NULLP;
    MacCellCfg macCellCfg;
    Inst inst = 0;
 
    if(clGlobalCp.phyState == PHY_STATE_RUNNING)
-   {
-      cellCbParams = rgCb[inst].cell;
-      macCellCfg = cellCbParams->macCellCfg;
-
-      if(currTimingInfo != NULLP)
-      {
-         currUlSlot = &macCb.macCell->ulSlot[currTimingInfo->slot % MAX_SLOT_SUPPORTED];
-         numPdu = getnPdus(NULL, currUlSlot);
-         msgSize = sizeof(fapi_ul_tti_req_t) + (numPdu * \
-            sizeof(fapi_ul_tti_req_pdu_t));
-         LWR_MAC_ALLOC(ulTtiReq, msgSize);
+       {
+               cellCbParams = rgCb[inst].cell;
+               macCellCfg = cellCbParams->macCellCfg;
 
 
-         if(ulTtiReq != NULLP)
-         {
-                          memset(ulTtiReq, 0, msgSize);
-            ulTtiReq->sfn = currTimingInfo->sfn;
-            ulTtiReq->slot = currTimingInfo->slot;
-            ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot);
-            ulTtiReq->nGroup = 0;
-            if(ulTtiReq->nPdus > 0)
-            {
-               ulTtiReq->pdus = (fapi_ul_tti_req_pdu_t *)(ulTtiReq + \
-                  (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_ul_tti_req_pdu_t*)));
-               /* Fill Prach Pdu */
-               if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PRACH)
-               {
-                  pduIdx++;
-                  fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
-               }
+               /* add PHY delta */
+               ADD_DELTA_TO_TIME(currTimingInfo,ulTtiReqTimingInfo,PHY_DELTA);
 
 
-               /* Fill PUSCH PDU */
-               if(currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PUSCH)
-               {
-                   pduIdx++;
-                   fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
-               }
+               currUlSlot = &macCb.macCell->ulSlot[ulTtiReqTimingInfo.slot % MAX_SLOT_SUPPORTED];
+               numPdu = getnPdus(NULL, currUlSlot);
+               msgSize = sizeof(fapi_ul_tti_req_t) + (numPdu*sizeof(fapi_ul_tti_req_pdu_t));
+               LWR_MAC_ALLOC(ulTtiReq, msgSize);
 
 
-               if((currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PRACH) || \
-                                          (currUlSlot->ulCellInfo.dataType & SCH_DATATYPE_PUSCH))
-               {
-                  msgLen += (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t));
-                  fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
-
-                  DU_LOG("\nLWR_MAC: Sending UL TTI Request");
-                  LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq);
-               }   
-            } 
-            else
-            {
-               msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
-               fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
-
-               DU_LOG("\nLWR_MAC: Sending UL TTI Request");
-               LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq);
-            }
-            memset(&currUlSlot, 0, sizeof(MacUlSlot));
-            return ROK;
-         }
-         else
-         {
-            DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
-                               memset(&currUlSlot, 0, sizeof(MacUlSlot));
-            return RFAILED;
-         }
-      }
-      else
-      {
-         DU_LOG("\nLWR_MAC: Current TTI Info in UL is NULL");
-         return RFAILED;
-      }
-   }
+               if(ulTtiReq != NULLP)
+               {
+                       memset(ulTtiReq, 0, msgSize);
+                       ulTtiReq->sfn  = currTimingInfo.sfn;
+                       ulTtiReq->slot = currTimingInfo.slot;
+                       ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot);
+                       ulTtiReq->nGroup = 0;
+                       if(ulTtiReq->nPdus > 0)
+                       {
+                               ulTtiReq->pdus = (fapi_ul_tti_req_pdu_t *)(ulTtiReq + \
+                                               (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_ul_tti_req_pdu_t*)));
+                               /* Fill Prach Pdu */
+                               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
+                               {
+                                       pduIdx++;
+                                       fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
+                               }
+
+                               /* Fill PUSCH PDU */
+                               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
+                               {
+                                       pduIdx++;
+                                       fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
+                               }
+
+                               if((currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH) || \
+                                               (currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH))
+                               {
+                                       msgLen += (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t));
+                                       fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
+
+                                       DU_LOG("\nLWR_MAC: Sending UL TTI Request");
+                                       LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq);
+                               }   
+                       } 
+                       else
+                       {
+                               msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
+                               fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
+
+                               DU_LOG("\nLWR_MAC: Sending UL TTI Request");
+                               LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq);
+                       }
+                       memset(&currUlSlot, 0, sizeof(MacUlSlot));
+                       return ROK;
+               }
+               else
+               {
+                       DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
+                       memset(&currUlSlot, 0, sizeof(MacUlSlot));
+                       return RFAILED;
+               }
+       }
    else
    {
    else
    {
-       lwr_mac_handleInvalidEvt(currTimingInfo);
+       lwr_mac_handleInvalidEvt(&currTimingInfo);
    }
 #endif
    return ROK;
    }
 #endif
    return ROK;
index 43f3c95..351a7ea 100644 (file)
@@ -44,8 +44,6 @@ S16 lwr_mac_handleConfigRspEvt(void *msg);
 S16 lwr_mac_handleStartReqEvt(void *msg);
 S16 lwr_mac_handleStopReqEvt(void *msg);
 void sendToLowerMac(U16, U32, void *);
 S16 lwr_mac_handleStartReqEvt(void *msg);
 S16 lwr_mac_handleStopReqEvt(void *msg);
 void sendToLowerMac(U16, U32, void *);
-uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo);
-uint16_t handleUlTtiReq(CmLteTimingInfo *currTimingInfo);
 void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 
 typedef S16 (*lwrMacFsmHdlr)(void *);
 void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 
 typedef S16 (*lwrMacFsmHdlr)(void *);
index 979381f..82fa484 100644 (file)
 
 typedef struct macDlSlot
 {
 
 typedef struct macDlSlot
 {
-   DlAlloc dlInfo;
+   DlSchedInfo dlInfo;
 }MacDlSlot;
 
 typedef struct macUlSlot
 {
 }MacDlSlot;
 
 typedef struct macUlSlot
 {
-   UlSchInfo    ulCellInfo;
+   UlSchedInfo  ulInfo;
 }MacUlSlot;
 
 typedef struct macCbInfo
 }MacUlSlot;
 
 typedef struct macCbInfo
index 5f75dc7..eed1dad 100644 (file)
@@ -17,6 +17,7 @@
 *******************************************************************************/
 
 /* header include files -- defines (.h)  */
 *******************************************************************************/
 
 /* header include files -- defines (.h)  */
+#include <stdbool.h>
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
index e5dda14..266a572 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <stdlib.h>
 #include <stdint.h>
 
 #include <stdlib.h>
 #include <stdint.h>
+#include <stdbool.h>
 
 /* header include files -- defines (.h) */
 #include "envopt.h"        /* environment options */
 
 /* header include files -- defines (.h) */
 #include "envopt.h"        /* environment options */
index 4520aab..8cc5f0c 100644 (file)
@@ -16,6 +16,7 @@
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
+#include <stdbool.h>
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
@@ -129,13 +130,13 @@ uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = 
 {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
 
 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = 
 {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
 
-int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo)
+int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
 {
 {
-   if(ulSchInfo != NULLP)
+   if(ulSchedInfo != NULLP)
        {
       MacUlSlot *currUlSlot = 
        {
       MacUlSlot *currUlSlot = 
-          &macCb.macCell->ulSlot[ulSchInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
-      memcpy(&currUlSlot->ulCellInfo, ulSchInfo, sizeof(UlSchInfo)); 
+          &macCb.macCell->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
+      memcpy(&currUlSlot->ulInfo, ulSchedInfo, sizeof(ulSchedInfo)); 
    }
    return ROK;
 }
    }
    return ROK;
 }
index cece129..8f686b3 100644 (file)
@@ -16,6 +16,7 @@
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
+#include "stdbool.h"
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
@@ -78,23 +79,42 @@ MacSchSlotIndFunc macSchSlotIndOpts[] =
  *      -# ROK 
  *      -# RFAILED 
  **/
  *      -# ROK 
  *      -# RFAILED 
  **/
-int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc)
+int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo)
 {
 {
-   if(dlAlloc != NULLP)
+   MacDlSlot *currDlSlot = NULLP;
+
+   if(dlSchedInfo != NULLP)
    {
    {
-      MacDlSlot *currDlSlot =
-      &macCb.macCell->dlSlot[dlAlloc->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
-      memcpy(&currDlSlot->dlInfo, dlAlloc, sizeof(DlAlloc)); 
-      
-      if(currDlSlot->dlInfo.msg4Alloc)
+               if(dlSchedInfo->isBroadcastPres)
+               {
+                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.broadcastTime.slot];
+                  currDlSlot->dlInfo.isBroadcastPres = true;
+                       memcpy(&currDlSlot->dlInfo.brdcstAlloc, &dlSchedInfo->brdcstAlloc, sizeof(DlBrdcstAlloc));
+               }
+
+               if(dlSchedInfo->rarAlloc != NULLP)
+               {
+                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.rarTime.slot];
+                       currDlSlot->dlInfo.rarAlloc = dlSchedInfo->rarAlloc;
+
+         /* MUXing of RAR */
+                       fillRarPdu(&currDlSlot->dlInfo.rarAlloc->rarInfo);
+               }
+
+               if(dlSchedInfo->msg4Alloc != NULLP)
       {
       {
+         Msg4Alloc *msg4Alloc = NULLP;
          MacDlData msg4DlData;
          MacCeInfo  macCeData;
          MacDlData msg4DlData;
          MacCeInfo  macCeData;
+
+                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.msg4Time.slot];
+                       currDlSlot->dlInfo.msg4Alloc = dlSchedInfo->msg4Alloc; /* copy msg4 alloc pointer in MAC slot info */
+                       msg4Alloc = dlSchedInfo->msg4Alloc;
+
          memset(&msg4DlData, 0, sizeof(MacDlData));
          memset(&macCeData, 0, sizeof(MacCeInfo));
 
          memset(&msg4DlData, 0, sizeof(MacDlData));
          memset(&macCeData, 0, sizeof(MacCeInfo));
 
-         macCb.macCell->macRaCb[0].msg4TbSize = \
-          dlAlloc->msg4Alloc->msg4PdschCfg.codeword[0].tbSize;
+         macCb.macCell->macRaCb[0].msg4TbSize = msg4Alloc->msg4PdschCfg.codeword[0].tbSize;
  
          if(macCb.macCell->macRaCb[0].msg4Pdu != NULLP)
          {
  
          if(macCb.macCell->macRaCb[0].msg4Pdu != NULLP)
          {
@@ -105,20 +125,23 @@ int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc)
                fillMsg4DlData(&msg4DlData);
             }
          }
                fillMsg4DlData(&msg4DlData);
             }
          }
+
+         /* MUXing for msg4 */
          fillMacCe(&macCeData);
          macMuxPdu(&msg4DlData, &macCeData, macCb.macCell->macRaCb[0].msg4TbSize);
       
          fillMacCe(&macCeData);
          macMuxPdu(&msg4DlData, &macCeData, macCb.macCell->macRaCb[0].msg4TbSize);
       
-         /* storing msg4 Pdu in dlAlloc */
-         MAC_ALLOC(dlAlloc->msg4Alloc->msg4Info.msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen);
-         if(dlAlloc->msg4Alloc->msg4Info.msg4Pdu != NULLP)
+         /* storing msg4 Pdu in macDlSlot */
+         MAC_ALLOC(msg4Alloc->msg4Info.msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen);
+         if(msg4Alloc->msg4Info.msg4Pdu != NULLP)
          {  
          {  
-            dlAlloc->msg4Alloc->msg4Info.msg4Pdu = macCb.macCell->macRaCb[0].msg4Pdu;
-            dlAlloc->msg4Alloc->msg4Info.msg4PduLen = macCb.macCell->macRaCb[0].msg4PduLen;
+            msg4Alloc->msg4Info.msg4Pdu = macCb.macCell->macRaCb[0].msg4Pdu;
+            msg4Alloc->msg4Info.msg4PduLen = macCb.macCell->macRaCb[0].msg4PduLen;
          }
          }
+
          /* TODO: Free all allocated memory, after the usage */
          /* MAC_FREE(macCb.macCell->macRaCb[0].msg4TxPdu, \
               macCb.macCell->macRaCb[0].msg4TbSize); // TODO: To be freed after re-transmission is successful.
          /* TODO: Free all allocated memory, after the usage */
          /* MAC_FREE(macCb.macCell->macRaCb[0].msg4TxPdu, \
               macCb.macCell->macRaCb[0].msg4TbSize); // TODO: To be freed after re-transmission is successful.
-            MAC_FREE(dlAlloc->msg4Alloc->msg4Info.msg4Pdu,\
+            MAC_FREE(dlSchedInfo->msg4Alloc->msg4Info.msg4Pdu,\
               macCb.macCell->macRaCb[0].msg4PduLen); //TODO: To be freed after lower-mac is succesfull
             MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell->macRaCb[0].msg4PduLen);
             MAC_FREE(macCb.macCell->macRaCb[0].msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen); */
               macCb.macCell->macRaCb[0].msg4PduLen); //TODO: To be freed after lower-mac is succesfull
             MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell->macRaCb[0].msg4PduLen);
             MAC_FREE(macCb.macCell->macRaCb[0].msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen); */
index 3249eb1..e609e17 100644 (file)
@@ -16,6 +16,7 @@
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
 ################################################################################
  *******************************************************************************/
 /* header include files (.h) */
+#include <stdbool.h>
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
index be24dac..072f221 100755 (executable)
@@ -36,6 +36,7 @@ static const char* RLOG_MODULE_NAME="MAC";
 static int RLOG_FILE_ID=182;
 static int RLOG_MODULE_ID=4096;
 /* header include files -- defines (.h) */
 static int RLOG_FILE_ID=182;
 static int RLOG_MODULE_ID=4096;
 /* header include files -- defines (.h) */
+#include <stdbool.h>
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
index e96308a..8502480 100755 (executable)
@@ -38,6 +38,7 @@ static int RLOG_FILE_ID=220;
 static int RLOG_MODULE_ID=4096;
 
 /* header include files (.h) */
 static int RLOG_MODULE_ID=4096;
 
 /* header include files (.h) */
+#include "stdbool.h"
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
@@ -2222,26 +2223,26 @@ int MacSchCellCfgReq
    schCellCfg.schInitialDlBwp.bwp.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
    schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
    schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
    schCellCfg.schInitialDlBwp.bwp.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
    schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
    schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId =
-          macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.coresetId =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.coresetId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.duration =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.duration;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1 =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2 =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4 =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8 =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8;
-   schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16 =
-      macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
+          macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
    schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
    schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
       macCellCfg->initialDlBwp.pdschCommon.mappingType;
    schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
    schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
       macCellCfg->initialDlBwp.pdschCommon.mappingType;
index f18947b..316d216 100755 (executable)
@@ -36,6 +36,7 @@ static int RLOG_MODULE_ID=4096;
 invoked by PHY towards MAC
 */
 /* header include files -- defines (.h) */
 invoked by PHY towards MAC
 */
 /* header include files -- defines (.h) */
+#include <stdbool.h>
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
@@ -613,14 +614,12 @@ SlotIndInfo slotInd
    }
 #endif
 
    }
 #endif
 
-   CmLteTimingInfo   timingInfo;
-   RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DELTA);
 
    /* Trigger for DL TTI REQ */
 
    /* Trigger for DL TTI REQ */
-   handleDlTtiReq(&timingInfo);
+   handleDlTtiReq(slotInd);
 
    /* Trigger for UL TTI REQ */
 
    /* Trigger for UL TTI REQ */
-   handleUlTtiReq(&timingInfo);
+   handleUlTtiReq(slotInd);
 
    dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
 
 
    dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
 
index aa93712..7fe9729 100644 (file)
@@ -65,6 +65,8 @@
 #include "sch.h"
 #include "sch_utils.h"
 #include "du_log.h"
 #include "sch.h"
 #include "sch_utils.h"
 #include "du_log.h"
+#include "common_def.h"
+
 extern SchCb schCb[SCH_MAX_INST];
 void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm);
 /* local defines */
 extern SchCb schCb[SCH_MAX_INST];
 void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm);
 /* local defines */
@@ -403,41 +405,41 @@ int InitSchCellCb(Inst inst, SchCellCfg *schCellCfg)
   
    for(uint8_t idx=0; idx<SCH_NUM_SLOTS; idx++)
        {
   
    for(uint8_t idx=0; idx<SCH_NUM_SLOTS; idx++)
        {
-               SchDlAlloc *schDlAlloc;
-               SchUlAlloc *schUlAlloc;
+               SchDlSlotInfo *schDlSlotInfo;
+               SchUlSlotInfo *schUlSlotInfo;
 
       /* DL Alloc */
 
       /* DL Alloc */
-               SCH_ALLOC(schDlAlloc, sizeof(SchDlAlloc));
-               if(!schDlAlloc)
+               SCH_ALLOC(schDlSlotInfo, sizeof(SchDlSlotInfo));
+               if(!schDlSlotInfo)
                {
                        DU_LOG("\nMemory allocation failed in InitSchCellCb");
                        return RFAILED;
                }
 
       /* UL Alloc */
                {
                        DU_LOG("\nMemory allocation failed in InitSchCellCb");
                        return RFAILED;
                }
 
       /* UL Alloc */
-               SCH_ALLOC(schUlAlloc, sizeof(SchUlAlloc));
-               if(!schUlAlloc)
+               SCH_ALLOC(schUlSlotInfo, sizeof(SchUlSlotInfo));
+               if(!schUlSlotInfo)
                {
                        DU_LOG("\nMemory allocation failed in InitSchCellCb");
                        return RFAILED;
                }
 
                {
                        DU_LOG("\nMemory allocation failed in InitSchCellCb");
                        return RFAILED;
                }
 
-      schDlAlloc->totalPrb = schUlAlloc->totalPrb = MAX_NUM_RB;
+      schDlSlotInfo->totalPrb = schUlSlotInfo->totalPrb = MAX_NUM_RB;
 
                for(uint8_t itr=0; itr<SCH_SYMBOL_PER_SLOT; itr++)
                {
 
                for(uint8_t itr=0; itr<SCH_SYMBOL_PER_SLOT; itr++)
                {
-                       schDlAlloc->assignedPrb[itr] = 0;
-                       schUlAlloc->assignedPrb[itr] = 0;
+                       schDlSlotInfo->assignedPrb[itr] = 0;
+                       schUlSlotInfo->assignedPrb[itr] = 0;
                }
                }
-               schUlAlloc->schPuschInfo = NULLP;
+               schUlSlotInfo->schPuschInfo = NULLP;
 
                for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
                {
 
                for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
                {
-                       memset(&schDlAlloc->ssbInfo[itr], 0, sizeof(SsbInfo));
+                       memset(&schDlSlotInfo->ssbInfo[itr], 0, sizeof(SsbInfo));
                }
 
                }
 
-               cell->dlAlloc[idx] = schDlAlloc;
-               cell->ulAlloc[idx] = schUlAlloc;
+               cell->schDlSlotInfo[idx] = schDlSlotInfo;
+               cell->schUlSlotInfo[idx] = schUlSlotInfo;
 
        }
        schCb[inst].cells[inst] = cell;
 
        }
        schCb[inst].cells[inst] = cell;
@@ -466,9 +468,12 @@ uint8_t      offsetPointA
    uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t slotIndex = 0;
    uint8_t FreqDomainResource[6] = {0};
    uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t slotIndex = 0;
    uint8_t FreqDomainResource[6] = {0};
+   uint16_t tbSize = 0;
+       uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
 
    PdcchCfg *pdcch = &(sib1SchCfg->sib1PdcchCfg);
    PdschCfg *pdsch = &(sib1SchCfg->sib1PdschCfg);
 
    PdcchCfg *pdcch = &(sib1SchCfg->sib1PdcchCfg);
    PdschCfg *pdsch = &(sib1SchCfg->sib1PdschCfg);
+   BwpCfg *bwp = &(sib1SchCfg->bwp);
 
    coreset0Idx     = sib1SchCfg->coresetZeroIndex;
    searchSpace0Idx = sib1SchCfg->searchSpaceZeroIndex;
 
    coreset0Idx     = sib1SchCfg->coresetZeroIndex;
    searchSpace0Idx = sib1SchCfg->searchSpaceZeroIndex;
@@ -496,11 +501,13 @@ uint8_t      offsetPointA
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
+   /* fill BWP */
+   bwp->BWPSize = MAX_NUM_RB; /* whole of BW */
+   bwp->BWPStart = 0;
+   bwp->subcarrierSpacing = 0;         /* 15Khz */
+   bwp->cyclicPrefix = 0;              /* normal */
+
    /* fill the PDCCH PDU */
    /* fill the PDCCH PDU */
-   pdcch->pdcchBwpCfg.BWPSize = MAX_NUM_RB; /* whole of BW */
-   pdcch->pdcchBwpCfg.BWPStart = 0;
-   pdcch->pdcchBwpCfg.subcarrierSpacing = 0;         /* 15Khz */
-   pdcch->pdcchBwpCfg.cyclicPrefix = 0;              /* normal */
    pdcch->coreset0Cfg.coreSet0Size = numRbs;
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
    pdcch->coreset0Cfg.coreSet0Size = numRbs;
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
@@ -533,8 +540,6 @@ uint8_t      offsetPointA
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    pdsch->rnti = 0xFFFF; /* SI-RNTI */
    pdsch->pduIndex = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    pdsch->rnti = 0xFFFF; /* SI-RNTI */
    pdsch->pduIndex = 0;
-   pdsch->pdschBwpCfg.BWPSize = MAX_NUM_RB; /* whole of BW */
-   pdsch->pdschBwpCfg.BWPStart = 0;
    pdsch->numCodewords = 1;
        for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
        {
    pdsch->numCodewords = 1;
        for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
        {
@@ -543,8 +548,8 @@ uint8_t      offsetPointA
       pdsch->codeword[cwCount].mcsIndex = sib1SchCfg->sib1Mcs;
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
       pdsch->codeword[cwCount].mcsIndex = sib1SchCfg->sib1Mcs;
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
-      pdsch->codeword[cwCount].tbSize = 768/8; /* 38.214: Table 5.1.3.2-1,
-                  devided by 8 to get the value in bytes */
+      tbSize = schCalcTbSize(sib1SchCfg->sib1PduLen);
+      pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
@@ -558,15 +563,11 @@ uint8_t      offsetPointA
    pdsch->dmrs.dmrsPorts = 0;
    pdsch->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */
    pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ 
    pdsch->dmrs.dmrsPorts = 0;
    pdsch->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */
    pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ 
-       /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 *
-        * Ninfo = Nre . R . Qm . v                                       *
-        * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh                       *
-        * Nre = min(156,Nre') . nPrb                                     */
-   pdsch->freqAlloc.rbSize = 10; /* This value is calculated from above formulae */
+   pdsch->freqAlloc.rbSize = schCalcNumPrb(tbSize,sib1SchCfg->sib1Mcs,numPdschSymbols);
    pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */
    pdsch->timeAlloc.rowIndex = 1;
    pdsch->timeAlloc.startSymbolIndex = 2; /* spec-38.214, Table 5.1.2.1-1 */
    pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */
    pdsch->timeAlloc.rowIndex = 1;
    pdsch->timeAlloc.startSymbolIndex = 2; /* spec-38.214, Table 5.1.2.1-1 */
-   pdsch->timeAlloc.numSymbols = 12;
+   pdsch->timeAlloc.numSymbols = numPdschSymbols;
    pdsch->beamPdschInfo.numPrgs = 1;
    pdsch->beamPdschInfo.prgSize = 1;
    pdsch->beamPdschInfo.digBfInterfaces = 0;
    pdsch->beamPdschInfo.numPrgs = 1;
    pdsch->beamPdschInfo.prgSize = 1;
    pdsch->beamPdschInfo.digBfInterfaces = 0;
@@ -650,28 +651,28 @@ uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo)
    DU_LOG("\nSCH : Received RLC BO Status indication");
 
    SchCellCb *cell = schCb[inst].cells[inst];
    DU_LOG("\nSCH : Received RLC BO Status indication");
 
    SchCellCb *cell = schCb[inst].cells[inst];
-   SchDlAlloc *dlAlloc = \
-      cell->dlAlloc[(cell->slotInfo.slot + SCHED_DELTA) % SCH_NUM_SLOTS]; 
+   SchDlSlotInfo *schDlSlotInfo = \
+      cell->schDlSlotInfo[(cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA) % SCH_NUM_SLOTS]; 
   
    for(lcIdx = 0; lcIdx < dlBoInfo->numLc; lcIdx++)
        {
           if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID)
                {
   
    for(lcIdx = 0; lcIdx < dlBoInfo->numLc; lcIdx++)
        {
           if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID)
                {
-             SCH_ALLOC(dlAlloc->msg4Info, sizeof(Msg4Info));
-             if(!dlAlloc->msg4Info)
+             SCH_ALLOC(schDlSlotInfo->msg4Info, sizeof(Msg4Info));
+             if(!schDlSlotInfo->msg4Info)
              {
                 DU_LOG("\nSCH : Memory allocation failed for msg4Info");
              {
                 DU_LOG("\nSCH : Memory allocation failed for msg4Info");
-                     dlAlloc = NULL;
+                     schDlSlotInfo = NULL;
                      return RFAILED;
              }
                      return RFAILED;
              }
-         dlAlloc->msg4Info->crnti = dlBoInfo->crnti;
-                       dlAlloc->msg4Info->ndi = 1;
-                       dlAlloc->msg4Info->harqProcNum = 0;
-                       dlAlloc->msg4Info->dlAssignIdx = 0;
-                       dlAlloc->msg4Info->pucchTpc = 0;
-                       dlAlloc->msg4Info->pucchResInd = 0;
-                       dlAlloc->msg4Info->harqFeedbackInd = 0;
-                       dlAlloc->msg4Info->dciFormatId = 1;
+         schDlSlotInfo->msg4Info->crnti = dlBoInfo->crnti;
+                       schDlSlotInfo->msg4Info->ndi = 1;
+                       schDlSlotInfo->msg4Info->harqProcNum = 0;
+                       schDlSlotInfo->msg4Info->dlAssignIdx = 0;
+                       schDlSlotInfo->msg4Info->pucchTpc = 0;
+                       schDlSlotInfo->msg4Info->pucchResInd = 0;
+                       schDlSlotInfo->msg4Info->harqFeedbackInd = 0;
+                       schDlSlotInfo->msg4Info->dciFormatId = 1;
           }
    }
 
           }
    }
 
index efc7851..96f3d22 100644 (file)
@@ -33,7 +33,8 @@
 #define SCH_MEM_REGION     4
 #define SCH_POOL           1
 #define SCHED_DELTA 1
 #define SCH_MEM_REGION     4
 #define SCH_POOL           1
 #define SCHED_DELTA 1
-#define RAR_DELAY   1
+#define BO_DELTA 1
+#define RAR_DELAY   2
 #define SCH_MAX_UE  1
 #define PUSCH_START_RB 15
 #define SI_RNTI 0xFFFF
 #define SCH_MAX_UE  1
 #define PUSCH_START_RB 15
 #define SI_RNTI 0xFFFF
@@ -91,7 +92,7 @@ typedef struct schGenCb
   * @brief
   * scheduler allocationsfor DL per cell.
   */
   * @brief
   * scheduler allocationsfor DL per cell.
   */
-typedef struct schDlAlloc
+typedef struct schDlSlotInfo
 {
        uint16_t    totalPrb;  /*!< Number of RBs in the cell */
        uint16_t    assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
 {
        uint16_t    totalPrb;  /*!< Number of RBs in the cell */
        uint16_t    assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
@@ -99,10 +100,10 @@ typedef struct schDlAlloc
    uint8_t     ssbIdxSupported;  /*!< Max SSB index */
        SsbInfo     ssbInfo[MAX_SSB_IDX]; /*!< SSB info */
        bool        sib1Pres;
    uint8_t     ssbIdxSupported;  /*!< Max SSB index */
        SsbInfo     ssbInfo[MAX_SSB_IDX]; /*!< SSB info */
        bool        sib1Pres;
-       bool        rarPres;
-       RarInfo     rarInfo;
+       //bool        rarPres;
+       RarInfo     *rarInfo;
    Msg4Info    *msg4Info;
    Msg4Info    *msg4Info;
-}SchDlAlloc;
+}SchDlSlotInfo;
 
 typedef struct schRaCb
 {
 
 typedef struct schRaCb
 {
@@ -113,13 +114,13 @@ typedef struct schRaCb
   * @brief
   * scheduler allocationsfor UL per cell.
   */
   * @brief
   * scheduler allocationsfor UL per cell.
   */
-typedef struct schUlAlloc
+typedef struct schUlSlotInfo
 {
        uint16_t     totalPrb;  /*!< Number of RBs in the cell */
        uint16_t     assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
        bool         puschPres; /*!< PUSCH presence field */
        SchPuschInfo *schPuschInfo; /*!< PUSCH info */
 {
        uint16_t     totalPrb;  /*!< Number of RBs in the cell */
        uint16_t     assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
        bool         puschPres; /*!< PUSCH presence field */
        SchPuschInfo *schPuschInfo; /*!< PUSCH info */
-}SchUlAlloc;
+}SchUlSlotInfo;
 
 /**
   * @brief
 
 /**
   * @brief
@@ -132,8 +133,8 @@ typedef struct schCellCb
    Inst          macInst;          /*!< Index of the MAC instance */
        uint8_t       numSlots;         /*!< Number of slots in current frame */
    SlotIndInfo   slotInfo;         /*!< SFN, Slot info being processed*/
    Inst          macInst;          /*!< Index of the MAC instance */
        uint8_t       numSlots;         /*!< Number of slots in current frame */
    SlotIndInfo   slotInfo;         /*!< SFN, Slot info being processed*/
-   SchDlAlloc    *dlAlloc[SCH_NUM_SLOTS]; /*!< SCH resource allocations in DL */
-   SchUlAlloc    *ulAlloc[SCH_NUM_SLOTS]; /*!< SCH resource allocations in UL */
+   SchDlSlotInfo *schDlSlotInfo[SCH_NUM_SLOTS]; /*!< SCH resource allocations in DL */
+   SchUlSlotInfo *schUlSlotInfo[SCH_NUM_SLOTS]; /*!< SCH resource allocations in UL */
        SchCellCfg    cellCfg;                /*!< Cell ocnfiguration */
        SchRaCb       raCb[SCH_MAX_UE];
 }SchCellCb;
        SchCellCfg    cellCfg;                /*!< Cell ocnfiguration */
        SchRaCb       raCb[SCH_MAX_UE];
 }SchCellCb;
index 8a1ad71..de0d764 100644 (file)
@@ -61,6 +61,7 @@ File:     sch_common.c
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
+#include "common_def.h"
 
 extern SchCb schCb[SCH_MAX_INST];
 extern uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8];
 
 extern SchCb schCb[SCH_MAX_INST];
 extern uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8];
@@ -127,10 +128,10 @@ uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,
        /* schedule SSB */
        uint8_t scs, ssbStartPrb, ssbStartSymb, idx;
        uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM];
        /* schedule SSB */
        uint8_t scs, ssbStartPrb, ssbStartSymb, idx;
        uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM];
-       SchDlAlloc *dlAlloc;
+       SchDlSlotInfo *schDlSlotInfo;
        SsbInfo ssbInfo;
 
        SsbInfo ssbInfo;
 
-       dlAlloc = cell->dlAlloc[slot];
+       schDlSlotInfo = cell->schDlSlotInfo[slot];
        if(dlBrdcstAlloc->ssbTrans)
        {
                scs = cell->cellCfg.ssbSchCfg.scsCommon;
        if(dlBrdcstAlloc->ssbTrans)
        {
                scs = cell->cellCfg.ssbSchCfg.scsCommon;
@@ -148,27 +149,26 @@ uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,
                        ssbInfo.tdAlloc.startSymb = ssbStartSymb;
                        ssbInfo.tdAlloc.numSymb   = SCH_SSB_SYMB_DURATION;
                        dlBrdcstAlloc->ssbInfo[idx] = ssbInfo;
                        ssbInfo.tdAlloc.startSymb = ssbStartSymb;
                        ssbInfo.tdAlloc.numSymb   = SCH_SSB_SYMB_DURATION;
                        dlBrdcstAlloc->ssbInfo[idx] = ssbInfo;
-                       dlAlloc->ssbInfo[idx] = ssbInfo;
-
+                       schDlSlotInfo->ssbInfo[idx] = ssbInfo;
                }
 
                }
 
-               dlAlloc->ssbPres = true;
-               dlAlloc->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported;
+               schDlSlotInfo->ssbPres = true;
+               schDlSlotInfo->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported;
                for(idx=ssbStartSymb; idx<ssbStartSymb+SCH_SSB_SYMB_DURATION; idx++)
                {
                for(idx=ssbStartSymb; idx<ssbStartSymb+SCH_SSB_SYMB_DURATION; idx++)
                {
-                       dlAlloc->assignedPrb[idx] = ssbStartPrb + SCH_SSB_PRB_DURATION + 1; /* +1 for kSsb */
+                       schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_PRB_DURATION + 1; /* +1 for kSsb */
                }
                }
-
        }
 
        /* SIB1 allocation */
        if(dlBrdcstAlloc->sib1Trans)
        {
        }
 
        /* SIB1 allocation */
        if(dlBrdcstAlloc->sib1Trans)
        {
-               dlAlloc->sib1Pres = true;
+               schDlSlotInfo->sib1Pres = true;
                for(idx=0; idx<SCH_SYMBOL_PER_SLOT; idx++)
                {
                for(idx=0; idx<SCH_SYMBOL_PER_SLOT; idx++)
                {
-                       dlAlloc->assignedPrb[idx] = ssbStartPrb + SCH_SSB_PRB_DURATION + 1 + 10; /* 10 PRBs for sib1 */
+                       schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_PRB_DURATION + 1 + 10; /* 10 PRBs for sib1 */
                }
                }
+          memcpy(&dlBrdcstAlloc->sib1Alloc.bwp, &cell->cellCfg.sib1SchCfg.bwp, sizeof(BwpCfg)); 
           memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
           memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdschCfg, &cell->cellCfg.sib1SchCfg.sib1PdschCfg, sizeof(PdschCfg)); 
        }
           memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
           memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdschCfg, &cell->cellCfg.sib1SchCfg.sib1PdschCfg, sizeof(PdschCfg)); 
        }
@@ -191,7 +191,7 @@ uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,
  *         RFAILED - failure
  *
  * ****************************************************************/
  *         RFAILED - failure
  *
  * ****************************************************************/
-int sendUlSchInfoToMac(UlSchInfo *ulSchInfo, Inst inst)
+int sendUlSchInfoToMac(UlSchedInfo *ulSchedInfo, Inst inst)
 {
        Pst pst;
 
 {
        Pst pst;
 
@@ -199,8 +199,7 @@ int sendUlSchInfoToMac(UlSchInfo *ulSchInfo, Inst inst)
    SCH_FILL_RSP_PST(pst, inst);
        pst.event = EVENT_UL_SCH_INFO;
 
    SCH_FILL_RSP_PST(pst, inst);
        pst.event = EVENT_UL_SCH_INFO;
 
-       return(*schMacUlSchInfoOpts[pst.selector])(&pst, ulSchInfo);
-
+       return(*schMacUlSchInfoOpts[pst.selector])(&pst, ulSchedInfo);
 }
 /**
  * @brief resource allocation for PRACH
 }
 /**
  * @brief resource allocation for PRACH
@@ -212,16 +211,14 @@ int sendUlSchInfoToMac(UlSchInfo *ulSchInfo, Inst inst)
  *     This function handles PRACH allocation
  *     
  *  @param[in]  SchCellCb *cell, cell cb
  *     This function handles PRACH allocation
  *     
  *  @param[in]  SchCellCb *cell, cell cb
- *  @param[in]  UlSchInfo *ulSchInfo, UL scheduling info
+ *  @param[in]  UlSchedInfo *ulSchedInfo, UL scheduling info
  *  @return  void
  **/
  *  @return  void
  **/
-int schPrachResAlloc(SchCellCb *cell, UlSchInfo *ulSchInfo)
+int schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo prachOccasionTimingInfo)
 {
    uint8_t  numPrachRb = 0;
        uint8_t  numRa = 0;
        uint8_t  freqStart = 0;
 {
    uint8_t  numPrachRb = 0;
        uint8_t  numRa = 0;
        uint8_t  freqStart = 0;
-       uint16_t sfn = 0;
-       uint16_t slot = 0;
        uint8_t  prachCfgIdx = 0;
        uint8_t  prachFormat = 0;
        uint8_t  x = 0;
        uint8_t  prachCfgIdx = 0;
        uint8_t  prachFormat = 0;
        uint8_t  x = 0;
@@ -231,11 +228,9 @@ int schPrachResAlloc(SchCellCb *cell, UlSchInfo *ulSchInfo)
        uint8_t  prachOcas = 0;
        uint8_t  dataType = 0;
        uint8_t  idx = 0;
        uint8_t  prachOcas = 0;
        uint8_t  dataType = 0;
        uint8_t  idx = 0;
-       SchUlAlloc *ulAlloc = NULLP;
+       SchUlSlotInfo *schUlSlotInfo = NULLP;
 
 
-       sfn  = cell->slotInfo.sfn;
-       slot = cell->slotInfo.slot; 
-       ulAlloc = cell->ulAlloc[cell->slotInfo.slot];
+       schUlSlotInfo = cell->schUlSlotInfo[prachOccasionTimingInfo.slot];
        prachCfgIdx = cell->cellCfg.schRachCfg.prachCfgIdx;
 
     /* derive the prachCfgIdx table paramters */
        prachCfgIdx = cell->cellCfg.schRachCfg.prachCfgIdx;
 
     /* derive the prachCfgIdx table paramters */
@@ -243,14 +238,14 @@ int schPrachResAlloc(SchCellCb *cell, UlSchInfo *ulSchInfo)
        y                = prachCfgIdxTable[prachCfgIdx][2];
        prachSubframe    = prachCfgIdxTable[prachCfgIdx][3];
        
        y                = prachCfgIdxTable[prachCfgIdx][2];
        prachSubframe    = prachCfgIdxTable[prachCfgIdx][3];
        
-       if((sfn%x) != y)
+       if((prachOccasionTimingInfo.sfn%x) != y)
        {
           /* prach occasion does not lie in this SFN */
                DU_LOG("\nPRACH ocassion doesn't lie in this SFN");
           return RFAILED;
        }
        /* check for subFrame number */
        {
           /* prach occasion does not lie in this SFN */
                DU_LOG("\nPRACH ocassion doesn't lie in this SFN");
           return RFAILED;
        }
        /* check for subFrame number */
-       if ((1 << slot) & prachSubframe)
+       if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
        {
       /* prach ocassion present in this subframe */
 
        {
       /* prach ocassion present in this subframe */
 
@@ -272,19 +267,15 @@ int schPrachResAlloc(SchCellCb *cell, UlSchInfo *ulSchInfo)
                dataType |= SCH_DATATYPE_PRACH;
                /* Considering first slot in the frame for PRACH */
                idx = 0;
                dataType |= SCH_DATATYPE_PRACH;
                /* Considering first slot in the frame for PRACH */
                idx = 0;
-               ulAlloc->assignedPrb[idx] = freqStart+numPrachRb;
+               schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
        }
 
        }
 
-       /* Fill UL SCH Info */
-       ulSchInfo->cellId = cell->cellId;
-       ulSchInfo->slotIndInfo.sfn = sfn;
-   ulSchInfo->slotIndInfo.slot = slot;
-       ulSchInfo->dataType = dataType;
+       ulSchedInfo->dataType = dataType;
        /* prach info */
        /* prach info */
-       ulSchInfo->prachSchInfo.numPrachOcas   = prachOcas;
-       ulSchInfo->prachSchInfo.prachFormat    = prachFormat;
-       ulSchInfo->prachSchInfo.numRa          = numRa;
-       ulSchInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
+       ulSchedInfo->prachSchInfo.numPrachOcas   = prachOcas;
+       ulSchedInfo->prachSchInfo.prachFormat    = prachFormat;
+       ulSchedInfo->prachSchInfo.numRa          = numRa;
+       ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
 
        return ROK;
 }
 
        return ROK;
 }
@@ -304,26 +295,34 @@ int schPrachResAlloc(SchCellCb *cell, UlSchInfo *ulSchInfo)
 uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 {
    int ret = ROK;
 uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 {
    int ret = ROK;
-   UlSchInfo ulSchInfo;
-       SchUlAlloc *ulAlloc;
+       UlSchedInfo ulSchedInfo;
+   SchUlSlotInfo  *schUlSlotInfo;
+   SlotIndInfo ulTimingInfo;
+
+   /* add PHY delta */
+   ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA+SCHED_DELTA);
+
+       ulSchedInfo.cellId = cell->cellId;
+       ulSchedInfo.slotIndInfo.sfn = ulTimingInfo.sfn;
+   ulSchedInfo.slotIndInfo.slot = ulTimingInfo.slot;
 
    /* Schedule resources for PRACH */
 
    /* Schedule resources for PRACH */
-       schPrachResAlloc(cell, &ulSchInfo);
+       schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
 
 
-       ulAlloc = cell->ulAlloc[cell->slotInfo.slot]; 
+       schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; 
        
        
-       if(ulAlloc->schPuschInfo)
+       if(schUlSlotInfo->schPuschInfo)
        {
        {
-          ulSchInfo.crnti = cell->raCb[0].tcrnti;
-               ulSchInfo.dataType |= SCH_DATATYPE_PUSCH;
-               memcpy(&ulSchInfo.schPuschInfo, ulAlloc->schPuschInfo,
+      ulSchedInfo.crnti = cell->raCb[0].tcrnti;
+               ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH;
+               memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo,
                                sizeof(SchPuschInfo));
                                sizeof(SchPuschInfo));
-               SCH_FREE(ulAlloc->schPuschInfo, sizeof(SchPuschInfo));
-               ulAlloc->schPuschInfo = NULL;
+               SCH_FREE(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
+               schUlSlotInfo->schPuschInfo = NULL;
        }
 
        //send msg to MAC
        }
 
        //send msg to MAC
-   ret = sendUlSchInfoToMac(&ulSchInfo, schInst);
+   ret = sendUlSchInfoToMac(&ulSchedInfo, schInst);
    if(ret != ROK)
    {
       DU_LOG("\nSending UL Sch info from SCH to MAC failed");
    if(ret != ROK)
    {
       DU_LOG("\nSending UL Sch info from SCH to MAC failed");
@@ -361,10 +360,11 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
 
    PdcchCfg *pdcch = &msg4Alloc->msg4PdcchCfg;
    PdschCfg *pdsch = &msg4Alloc->msg4PdschCfg;
 
    PdcchCfg *pdcch = &msg4Alloc->msg4PdcchCfg;
    PdschCfg *pdsch = &msg4Alloc->msg4PdschCfg;
+   BwpCfg *bwp = &msg4Alloc->bwp;
 
    initialBwp   = &cell->cellCfg.schInitialDlBwp;
    offsetPointA = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
 
    initialBwp   = &cell->cellCfg.schInitialDlBwp;
    offsetPointA = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
-   coreset0Idx  = initialBwp->pdcchCommon.raSearchSpace.coresetId;
+   coreset0Idx  = initialBwp->pdcchCommon.commonSearchSpace.coresetId;
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
    numRbs        = coresetIdxTable[coreset0Idx][1];
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
    numRbs        = coresetIdxTable[coreset0Idx][1];
@@ -375,7 +375,7 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    uint16_t mask = 0x2000;
    for(firstSymbol=0; firstSymbol<14;firstSymbol++)
    {
    uint16_t mask = 0x2000;
    for(firstSymbol=0; firstSymbol<14;firstSymbol++)
    {
-      if(initialBwp->pdcchCommon.raSearchSpace.monitoringSymbol & mask)
+      if(initialBwp->pdcchCommon.commonSearchSpace.monitoringSymbol & mask)
          break;
       else
          mask = mask>>1;
          break;
       else
          mask = mask>>1;
@@ -384,11 +384,13 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
+   /* fill BWP */
+   bwp->BWPSize = initialBwp->bwp.numPrb;
+   bwp->BWPStart = initialBwp->bwp.firstPrb;
+   bwp->subcarrierSpacing = initialBwp->bwp.scs;
+   bwp->cyclicPrefix = initialBwp->bwp.cyclicPrefix;
+
    /* fill the PDCCH PDU */
    /* fill the PDCCH PDU */
-   pdcch->pdcchBwpCfg.BWPSize = initialBwp->bwp.numPrb;
-   pdcch->pdcchBwpCfg.BWPStart = initialBwp->bwp.firstPrb;
-   pdcch->pdcchBwpCfg.subcarrierSpacing = initialBwp->bwp.scs;
-   pdcch->pdcchBwpCfg.cyclicPrefix = initialBwp->bwp.cyclicPrefix;
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
    memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6);
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
    memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6);
@@ -400,7 +402,7 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    pdcch->coreset0Cfg.shiftIndex = cell->cellCfg.phyCellId;
    pdcch->coreset0Cfg.precoderGranularity = 0; /* sameAsRegBundle */
    pdcch->numDlDci = 1;
    pdcch->coreset0Cfg.shiftIndex = cell->cellCfg.phyCellId;
    pdcch->coreset0Cfg.precoderGranularity = 0; /* sameAsRegBundle */
    pdcch->numDlDci = 1;
-   pdcch->dci.rnti = cell->dlAlloc[slot]->msg4Info->crnti;
+   pdcch->dci.rnti = cell->schDlSlotInfo[slot]->msg4Info->crnti;
    pdcch->dci.scramblingId = cell->cellCfg.phyCellId;
    pdcch->dci.scramblingRnti = 0;
    pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
    pdcch->dci.scramblingId = cell->cellCfg.phyCellId;
    pdcch->dci.scramblingRnti = 0;
    pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
@@ -416,10 +418,8 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    /* fill the PDSCH PDU */
    uint8_t cwCount = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    /* fill the PDSCH PDU */
    uint8_t cwCount = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
-   pdsch->rnti = cell->dlAlloc[slot]->msg4Info->crnti;
+   pdsch->rnti = cell->schDlSlotInfo[slot]->msg4Info->crnti;
    pdsch->pduIndex = 0;
    pdsch->pduIndex = 0;
-   pdsch->pdschBwpCfg.BWPSize = initialBwp->bwp.numPrb;
-   pdsch->pdschBwpCfg.BWPStart = initialBwp->bwp.firstPrb;
    pdsch->numCodewords = 1;
    for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
    {
    pdsch->numCodewords = 1;
    for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
    {
index 69d2a62..c6f3bde 100644 (file)
@@ -62,6 +62,7 @@
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
+#include "common_def.h"
 
 extern SchCb schCb[SCH_MAX_INST];
 extern uint8_t puschDeltaTable[MAX_MU_PUSCH];
 
 extern SchCb schCb[SCH_MAX_INST];
 extern uint8_t puschDeltaTable[MAX_MU_PUSCH];
@@ -124,8 +125,8 @@ void createSchRaCb(uint16_t tcrnti, Inst schInst)
 uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t *msg3StartRb,
 uint8_t *msg3NumRb)
 {
 uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t *msg3StartRb,
 uint8_t *msg3NumRb)
 {
-       SchCellCb  *cell         = NULLP;
-       SchUlAlloc *ulAlloc      = NULLP;
+       SchCellCb      *cell         = NULLP;
+       SchUlSlotInfo  *schUlSlotInfo    = NULLP;
        uint8_t    puschMu       = 0;
        uint8_t    msg3SlotAlloc = 0;
        uint8_t    delta         = 0;
        uint8_t    puschMu       = 0;
        uint8_t    msg3SlotAlloc = 0;
        uint8_t    delta         = 0;
@@ -161,26 +162,26 @@ uint8_t *msg3NumRb)
 
        for(idx=startSymb; idx<symbLen; idx++)
        {
 
        for(idx=startSymb; idx<symbLen; idx++)
        {
-               cell->ulAlloc[msg3SlotAlloc]->assignedPrb[idx] = startRb + numRb;
+               cell->schUlSlotInfo[msg3SlotAlloc]->assignedPrb[idx] = startRb + numRb;
        }
        }
-       ulAlloc = cell->ulAlloc[msg3SlotAlloc];
+       schUlSlotInfo = cell->schUlSlotInfo[msg3SlotAlloc];
 
 
-   SCH_ALLOC(ulAlloc->schPuschInfo, sizeof(SchPuschInfo));
-       if(!ulAlloc->schPuschInfo)
+   SCH_ALLOC(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
+       if(!schUlSlotInfo->schPuschInfo)
        {
       DU_LOG("SCH: Memory allocation failed in schAllocMsg3Pusch");
                return RFAILED;
        }
        {
       DU_LOG("SCH: Memory allocation failed in schAllocMsg3Pusch");
                return RFAILED;
        }
-       ulAlloc->schPuschInfo->harqProcId        = SCH_HARQ_PROC_ID;
-       ulAlloc->schPuschInfo->resAllocType      = SCH_ALLOC_TYPE_1;
-       ulAlloc->schPuschInfo->fdAlloc.startPrb  = startRb;
-       ulAlloc->schPuschInfo->fdAlloc.numPrb    = numRb;
-       ulAlloc->schPuschInfo->tdAlloc.startSymb = startSymb;
-       ulAlloc->schPuschInfo->tdAlloc.numSymb   = symbLen;
-       ulAlloc->schPuschInfo->tbInfo.mcs            = 4;
-       ulAlloc->schPuschInfo->tbInfo.ndi        = 1; /* new transmission */
-       ulAlloc->schPuschInfo->tbInfo.rv                = 0;
-       ulAlloc->schPuschInfo->tbInfo.tbSize     = 24; /*Considering 2 PRBs */
+       schUlSlotInfo->schPuschInfo->harqProcId        = SCH_HARQ_PROC_ID;
+       schUlSlotInfo->schPuschInfo->resAllocType      = SCH_ALLOC_TYPE_1;
+       schUlSlotInfo->schPuschInfo->fdAlloc.startPrb  = startRb;
+       schUlSlotInfo->schPuschInfo->fdAlloc.numPrb    = numRb;
+       schUlSlotInfo->schPuschInfo->tdAlloc.startSymb = startSymb;
+       schUlSlotInfo->schPuschInfo->tdAlloc.numSymb   = symbLen;
+       schUlSlotInfo->schPuschInfo->tbInfo.mcs      = 4;
+       schUlSlotInfo->schPuschInfo->tbInfo.ndi        = 1; /* new transmission */
+       schUlSlotInfo->schPuschInfo->tbInfo.rv          = 0;
+       schUlSlotInfo->schPuschInfo->tbInfo.tbSize     = 24; /*Considering 2 PRBs */
 
        *msg3StartRb = startRb;
        *msg3NumRb   = numRb;
 
        *msg3StartRb = startRb;
        *msg3NumRb   = numRb;
@@ -206,20 +207,28 @@ uint8_t *msg3NumRb)
 uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
 {
    SchCellCb *cell = schCb[schInst].cells[schInst];
 uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
 {
    SchCellCb *cell = schCb[schInst].cells[schInst];
+       RarInfo *rarInfo = NULLP;
        uint16_t raRnti = 0;
        uint16_t raRnti = 0;
-       uint16_t slot;
+       uint16_t rarSlot = 0;
        uint16_t msg3StartRb;
        uint8_t  msg3NumRb;
    uint8_t  ret = ROK;
        uint16_t msg3StartRb;
        uint8_t  msg3NumRb;
    uint8_t  ret = ROK;
-   /* RAR will sent in the next slot */
-       slot = (rachInd->timingInfo.slot+SCHED_DELTA+RAR_DELAY)%SCH_NUM_SLOTS;
 
 
-   SchDlAlloc *dlAlloc =  cell->dlAlloc[slot];
-       RarInfo *rarInfo = &(dlAlloc->rarInfo);
+   /* RAR will sent with a delay of RAR_DELAY */
+   rarSlot = (rachInd->timingInfo.slot+RAR_DELAY+PHY_DELTA)%SCH_NUM_SLOTS;
 
 
-   /* rar message presense in next slot ind and will be scheduled */
-   dlAlloc->rarPres = true;
+   SchDlSlotInfo *schDlSlotInfo = cell->schDlSlotInfo[rarSlot]; /* RAR will sent in the next slot */
 
 
+   /* Allocate the rarInfo, this pointer will be checked at schProcessSlotInd function */
+       SCH_ALLOC(rarInfo, sizeof(RarInfo));
+       if(rarInfo == NULLP)
+       {
+      DU_LOG("\nMAC: Memory Allocation failed for rarInfo");
+      return RFAILED;
+       }
+
+       schDlSlotInfo->rarInfo = rarInfo;
+   
    /* calculate the ra-rnti value */
        raRnti = calculateRaRnti(rachInd->symbolIdx,rachInd->slotIdx,rachInd->freqIdx);
    
    /* calculate the ra-rnti value */
        raRnti = calculateRaRnti(rachInd->symbolIdx,rachInd->slotIdx,rachInd->freqIdx);
    
@@ -227,10 +236,9 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
        createSchRaCb(rachInd->crnti,schInst);
 
        /* allocate resources for msg3 */
        createSchRaCb(rachInd->crnti,schInst);
 
        /* allocate resources for msg3 */
-       ret = schAllocMsg3Pusch(schInst, slot, &msg3StartRb, &msg3NumRb);
+       ret = schAllocMsg3Pusch(schInst, rarSlot, &msg3StartRb, &msg3NumRb);
        if(ret == ROK)
        {
        if(ret == ROK)
        {
-
                /* fill RAR info */
                rarInfo->raRnti      = raRnti;
                rarInfo->tcrnti      = rachInd->crnti;
                /* fill RAR info */
                rarInfo->raRnti      = raRnti;
                rarInfo->tcrnti      = rachInd->crnti;
@@ -266,12 +274,17 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    uint8_t numSymbols = 0;
    uint8_t offset = 0;
    uint8_t FreqDomainResource[6] = {0};
    uint8_t numSymbols = 0;
    uint8_t offset = 0;
    uint8_t FreqDomainResource[6] = {0};
+   uint16_t tbSize = 0;
+       uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
+   uint8_t mcs = 4;  /* MCS fixed to 4 */
+
    SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialDlBwp;
 
        PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
        PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
    SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialDlBwp;
 
        PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
        PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
+   BwpCfg *bwp = &rarAlloc->bwp;
 
 
-   coreset0Idx     = initialBwp->pdcchCommon.raSearchSpace.coresetId;
+   coreset0Idx     = initialBwp->pdcchCommon.commonSearchSpace.coresetId;
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
    numRbs        = coresetIdxTable[coreset0Idx][1];
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
    numRbs        = coresetIdxTable[coreset0Idx][1];
@@ -283,7 +296,7 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
        uint16_t mask = 0x2000;
        for(firstSymbol=0; firstSymbol<14;firstSymbol++)
        {
        uint16_t mask = 0x2000;
        for(firstSymbol=0; firstSymbol<14;firstSymbol++)
        {
-          if(initialBwp->pdcchCommon.raSearchSpace.monitoringSymbol & mask)
+          if(initialBwp->pdcchCommon.commonSearchSpace.monitoringSymbol & mask)
                   break;
                else
                   mask = mask>>1;
                   break;
                else
                   mask = mask>>1;
@@ -292,11 +305,13 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* calculate the PRBs */
    calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
+   /* fill BWP */
+   bwp->BWPSize = initialBwp->bwp.numPrb;
+   bwp->BWPStart = initialBwp->bwp.firstPrb;
+   bwp->subcarrierSpacing = initialBwp->bwp.scs;
+   bwp->cyclicPrefix = initialBwp->bwp.cyclicPrefix;
+
    /* fill the PDCCH PDU */
    /* fill the PDCCH PDU */
-   pdcch->pdcchBwpCfg.BWPSize = initialBwp->bwp.numPrb;
-   pdcch->pdcchBwpCfg.BWPStart = initialBwp->bwp.firstPrb;
-   pdcch->pdcchBwpCfg.subcarrierSpacing = initialBwp->bwp.scs;
-   pdcch->pdcchBwpCfg.cyclicPrefix = initialBwp->bwp.cyclicPrefix;
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
    memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6);
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
    pdcch->coreset0Cfg.durationSymbols = numSymbols;
    memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6);
@@ -326,18 +341,16 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    pdsch->rnti = raRnti; /* RA-RNTI */
    pdsch->pduIndex = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    pdsch->rnti = raRnti; /* RA-RNTI */
    pdsch->pduIndex = 0;
-   pdsch->pdschBwpCfg.BWPSize = initialBwp->bwp.numPrb;
-   pdsch->pdschBwpCfg.BWPStart = initialBwp->bwp.firstPrb;
    pdsch->numCodewords = 1;
        for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
        {
       pdsch->codeword[cwCount].targetCodeRate = 308;
       pdsch->codeword[cwCount].qamModOrder = 2;
    pdsch->numCodewords = 1;
        for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
        {
       pdsch->codeword[cwCount].targetCodeRate = 308;
       pdsch->codeword[cwCount].qamModOrder = 2;
-      pdsch->codeword[cwCount].mcsIndex = 4; /* mcs configured to 4 */
-      pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
+      pdsch->codeword[cwCount].mcsIndex = mcs; /* mcs configured to 4 */
+      pdsch->codeword[cwCount].mcsTable = 0;   /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
       pdsch->codeword[cwCount].rvIndex = 0;
-      pdsch->codeword[cwCount].tbSize = 80/8; /* 38.214: Table 5.1.3.2-1,
-                  devided by 8 to get the value in bytes */
+               tbSize = schCalcTbSize(10); /* 8 bytes RAR and 2 bytes padding */
+      pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
@@ -351,11 +364,7 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    pdsch->dmrs.dmrsPorts = 0;
    pdsch->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */
    pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ 
    pdsch->dmrs.dmrsPorts = 0;
    pdsch->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */
    pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ 
-       /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 *
-        * Ninfo = S . Nre . R . Qm . v                                   *
-        * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh                       *
-        * Nre = min(156,Nre') . nPrb                                     */
-   pdsch->freqAlloc.rbSize = 1; /* This value is calculated from above formulae */
+   pdsch->freqAlloc.rbSize = schCalcNumPrb(tbSize,mcs,numPdschSymbols);
    pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */
    pdsch->timeAlloc.startSymbolIndex = initialBwp->pdschCommon.startSymbol;
    pdsch->timeAlloc.numSymbols = initialBwp->pdschCommon.lengthSymbol;
    pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */
    pdsch->timeAlloc.startSymbolIndex = initialBwp->pdschCommon.startSymbol;
    pdsch->timeAlloc.numSymbols = initialBwp->pdschCommon.lengthSymbol;
index 604ad1f..bb62aa2 100644 (file)
@@ -61,6 +61,7 @@ File:     sch_slot_ind.c
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
+#include "common_def.h"
 
 SchMacDlAllocFunc schMacDlAllocOpts[] =
 {
 
 SchMacDlAllocFunc schMacDlAllocOpts[] =
 {
@@ -89,7 +90,7 @@ offsetPointA);
  *         RFAILED - failure
  *
  * ****************************************************************/
  *         RFAILED - failure
  *
  * ****************************************************************/
-int sendDlAllocToMac(DlAlloc *dlAlloc, Inst inst)
+int sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst)
 {
        Pst pst;
 
 {
        Pst pst;
 
@@ -97,10 +98,49 @@ int sendDlAllocToMac(DlAlloc *dlAlloc, Inst inst)
    SCH_FILL_RSP_PST(pst, inst);
        pst.event = EVENT_DL_ALLOC;
 
    SCH_FILL_RSP_PST(pst, inst);
        pst.event = EVENT_DL_ALLOC;
 
-       return(*schMacDlAllocOpts[pst.selector])(&pst, dlAlloc);
+       return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo);
 
 }
 
 
 }
 
+
+/*******************************************************************
+ *
+ * @brief Handles slot indication at SCH 
+ *
+ * @details
+ *
+ *    Function : schCalcSlotValues
+ *
+ *    Functionality:
+ *     Handles TTI indication received from PHY
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue)
+{
+   /****************************************************************
+    * PHY_DELTA - the physical layer delta                         * 
+    * SCHED_DELTA - scheduler schedules one slot ahead             *
+    * BO_DELTA - this delay is considered for BO response and      *
+    *            RLC buffer packet to received at MAC              *
+    * lower-mac (FAPI filling) will be working on PHY_DELTA        *
+    * brdcast scheduler will working on PHY_DELTA + SCHED_DELTA    *
+    * RAR scheduler will working on PHY_DELTA + SCHED_DELTA        *
+    * msg4 scheduler will working on PHY_DELTA + SCHED_DELTA       *
+    * dedicated DL msg scheduler will working                      *
+    *        on PHY_DELTA + SCHED_DELTA + BO_DELTA                 *
+    ****************************************************************/
+
+   ADD_DELTA_TO_TIME(slotInd,schSlotValue->currentTime,PHY_DELTA);
+   ADD_DELTA_TO_TIME(slotInd,schSlotValue->broadcastTime,PHY_DELTA+SCHED_DELTA);
+   ADD_DELTA_TO_TIME(slotInd,schSlotValue->rarTime,PHY_DELTA+SCHED_DELTA);
+   ADD_DELTA_TO_TIME(slotInd,schSlotValue->msg4Time,PHY_DELTA+SCHED_DELTA);
+   ADD_DELTA_TO_TIME(slotInd,schSlotValue->dlMsgTime,PHY_DELTA+SCHED_DELTA+BO_DELTA);
+}
+
 /*******************************************************************
  *
  * @brief Handles slot indication at SCH 
 /*******************************************************************
  *
  * @brief Handles slot indication at SCH 
@@ -121,40 +161,27 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
 {
    int ret = ROK;
        uint8_t ssb_rep;
 {
    int ret = ROK;
        uint8_t ssb_rep;
-       uint16_t sfn  = slotInd->sfn;
-       uint16_t slot = slotInd->slot;
        uint16_t sfnSlot = 0;
        uint16_t sfnSlot = 0;
-       DlAlloc dlAlloc;
-       memset(&dlAlloc,0,sizeof(DlAlloc));
-   DlBrdcstAlloc *dlBrdcstAlloc = &dlAlloc.brdcstAlloc;
-       RarAlloc *rarAlloc = &dlAlloc.rarAlloc;
+       DlSchedInfo dlSchedInfo;
+       memset(&dlSchedInfo,0,sizeof(DlSchedInfo));
+   DlBrdcstAlloc *dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
+       RarAlloc  *rarAlloc;
    Msg4Alloc *msg4Alloc;
        dlBrdcstAlloc->ssbTrans = NO_SSB;
    dlBrdcstAlloc->sib1Trans = NO_SIB1;
        
    Msg4Alloc *msg4Alloc;
        dlBrdcstAlloc->ssbTrans = NO_SSB;
    dlBrdcstAlloc->sib1Trans = NO_SIB1;
        
-
        SchCellCb *cell = schCb[schInst].cells[schInst];
 
        SchCellCb *cell = schCb[schInst].cells[schInst];
 
-#ifdef LTE_L2_MEAS
-   glblTtiCnt++;
-#endif
-  
-//   schDlResAlloc(cell, slotInd);
+   schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue);
 
        ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
        memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
        dlBrdcstAlloc->ssbIdxSupported = 1;
 
 
        ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
        memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
        dlBrdcstAlloc->ssbIdxSupported = 1;
 
-   if((slot + SCHED_DELTA) >= SCH_NUM_SLOTS)
-       {
-      sfn = (sfn+1)%SCH_MAX_SFN;
-       }
-       slot = ((slot + SCHED_DELTA) % SCH_NUM_SLOTS);
-   sfnSlot = ((sfn * 10) + slot);
+   sfnSlot = ((dlSchedInfo.schSlotValue.broadcastTime.sfn * 10) +
+                   dlSchedInfo.schSlotValue.broadcastTime.slot);
 
 
-       dlAlloc.slotIndInfo.sfn = sfn;
-       dlAlloc.slotIndInfo.slot = slot;
-       dlAlloc.cellId = cell->cellId;
+       dlSchedInfo.cellId = cell->cellId;
 
        /* Identify SSB ocassion*/
        if (sfnSlot % SCH_MIB_TRANS == 0)
 
        /* Identify SSB ocassion*/
        if (sfnSlot % SCH_MIB_TRANS == 0)
@@ -186,8 +213,8 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
 
        if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans)
        {
 
        if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans)
        {
-          dlAlloc.isBroadcastPres = true;
-          ret = schBroadcastAlloc(cell, dlBrdcstAlloc,slot);
+          dlSchedInfo.isBroadcastPres = true;
+          ret = schBroadcastAlloc(cell,dlBrdcstAlloc,dlSchedInfo.schSlotValue.broadcastTime.slot);
       if(ret != ROK)
       {
          DU_LOG("\nschBroadcastAlloc failed");
       if(ret != ROK)
       {
          DU_LOG("\nschBroadcastAlloc failed");
@@ -196,23 +223,33 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
    }
 
    /* check for RAR */
    }
 
    /* check for RAR */
-       if(cell->dlAlloc[slot]->rarPres == true)
+       if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP)
        {
        {
-          dlAlloc.isRarPres = true;
+      SCH_ALLOC(rarAlloc, sizeof(RarAlloc));
+      if(!rarAlloc)
+      {
+                  DU_LOG("\nMAC: Memory Allocation failed for RAR alloc");
+                  return RFAILED;
+      }
+                
+      dlSchedInfo.rarAlloc = rarAlloc;
+
           /* RAR info is copied, this was earlier filled in schProcessRachInd */
           /* RAR info is copied, this was earlier filled in schProcessRachInd */
-          memcpy(&rarAlloc->rarInfo, &cell->dlAlloc[slot]->rarInfo, sizeof(RarInfo));
+      memcpy(&rarAlloc->rarInfo,cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo, \
+             sizeof(RarInfo));
 
 
-               /* pdcch and pdsch data is filled */
-      schFillRar(rarAlloc,
-                  cell->dlAlloc[slot]->rarInfo.raRnti,
-                  cell->cellCfg.phyCellId,
-                  cell->cellCfg.ssbSchCfg.ssbOffsetPointA);
+                /* pdcch and pdsch data is filled */
+       schFillRar(rarAlloc,
+                   cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo->raRnti,
+                   cell->cellCfg.phyCellId,
+                   cell->cellCfg.ssbSchCfg.ssbOffsetPointA);
 
 
-     cell->dlAlloc[slot]->rarPres = false;
+      SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo,sizeof(RarAlloc));
+          cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo = NULLP;
    }
 
    /* check for MSG4 */
    }
 
    /* check for MSG4 */
-   if(cell->dlAlloc[slot]->msg4Info)
+   if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info != NULLP)
    {
            SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc));
                 if(!msg4Alloc)
    {
            SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc));
                 if(!msg4Alloc)
@@ -221,21 +258,21 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
                         return RFAILED;
                 }
                 
                         return RFAILED;
                 }
                 
-                dlAlloc.msg4Alloc = msg4Alloc;
+                dlSchedInfo.msg4Alloc = msg4Alloc;
 
        /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */
 
        /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */
-       memcpy(&msg4Alloc->msg4Info, cell->dlAlloc[slot]->msg4Info, \
+       memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, \
           sizeof(Msg4Info));
              
        /* pdcch and pdsch data is filled */
           sizeof(Msg4Info));
              
        /* pdcch and pdsch data is filled */
-       schDlRsrcAllocMsg4(msg4Alloc, cell, slot); 
-                SCH_FREE(cell->dlAlloc[slot]->msg4Info, sizeof(Msg4Info));
-                cell->dlAlloc[slot]->msg4Info = NULL;
+       schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); 
+                SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info));
+                cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL;
    }
 
 
        /* send msg to MAC */
    }
 
 
        /* send msg to MAC */
-   ret = sendDlAllocToMac(&dlAlloc, schInst);
+   ret = sendDlAllocToMac(&dlSchedInfo, schInst);
    if(ret != ROK)
    {
       DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed");
    if(ret != ROK)
    {
       DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed");
index 0a79d67..b3d038d 100644 (file)
@@ -382,12 +382,58 @@ uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
 /* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */
 uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 };
 
 /* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */
 uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 };
 
+uint16_t tbSizeTable[TOTAL_TBSIZE_VALUES] = {
+         24,    32,    40,    48,    56,    64,    72,    80,    88,    96, \
+        104,   112,   120,   128,   136,   144,   152,   160,   168,   176, \
+        184,   192,   208,   224,   240,   256,   272,   288,   304,   320, \
+        336,   352,   368,   384,   408,   432,   456,   480,   504,   528, \
+        552,   576,   608,   640,   672,   704,   736,   768,   808,   848, \
+        888,   928,   984,  1032,  1064,  1128,  1160,  1192,  1224,  1256, \
+       1288,  1320,  1352,  1416,  1480,  1544,  1608,  1672,  1736,  1800, \
+       1864,  1928,  2024,  2088,  2152,  2216,  2280,  2408,  2472,  2536, \
+       2600,  2664,  2728,  2792,  2856,  2976,  3104,  3240,  3368,  3496, \
+       3624,  3752,  3824 };
+
+uint16_t mcsTable[32][3] = {
+      {   0,   2,   120},   /* mcs index  0 */ 
+      {   1,   2,   157},   /* mcs index  1 */ 
+      {   2,   2,   193},   /* mcs index  2 */ 
+      {   3,   2,   251},   /* mcs index  3 */ 
+      {   4,   2,   308},   /* mcs index  4 */ 
+      {   5,   2,   379},   /* mcs index  5 */ 
+      {   6,   2,   449},   /* mcs index  6 */ 
+      {   7,   2,   526},   /* mcs index  7 */ 
+      {   8,   2,   602},   /* mcs index  8 */ 
+      {   9,   2,   679},   /* mcs index  9 */ 
+      {  10,   4,   340},   /* mcs index 10 */ 
+      {  11,   4,   378},   /* mcs index 11 */ 
+      {  12,   4,   434},   /* mcs index 12 */ 
+      {  13,   4,   490},   /* mcs index 13 */ 
+      {  14,   4,   553},   /* mcs index 14 */ 
+      {  15,   4,   616},   /* mcs index 15 */
+      {  16,   4,   658},   /* mcs index 16 */
+      {  17,   6,   438},   /* mcs index 17 */
+      {  18,   6,   466},   /* mcs index 18 */
+      {  19,   6,   517},   /* mcs index 19 */
+      {  20,   6,   567},   /* mcs index 20 */
+      {  21,   6,   616},   /* mcs index 21 */
+      {  22,   6,   666},   /* mcs index 22 */
+      {  23,   6,   719},   /* mcs index 23 */
+      {  24,   6,   772},   /* mcs index 24 */
+      {  25,   6,   822},   /* mcs index 25 */
+      {  26,   6,   873},   /* mcs index 26 */
+      {  27,   6,   910},   /* mcs index 27 */
+      {  28,   6,   948},   /* mcs index 28 */
+      {  29,   2,     0},   /* mcs index 29 */
+      {  30,   4,     0},   /* mcs index 30 */
+      {  31,   6,     0}};  /* mcs index 31 */
+
 /**
  * @brief frequency domain allocation function. 
  *
  * @details
  *
 /**
  * @brief frequency domain allocation function. 
  *
  * @details
  *
- *     Function: canclulatePRB
+ *     Function: calculatePRB
  *     
  *     This function does allocation in frequency domain resource. using 
  *     bitwise operator, the bits are set for the PRBs.
  *     
  *     This function does allocation in frequency domain resource. using 
  *     bitwise operator, the bits are set for the PRBs.
@@ -439,6 +485,72 @@ void calculatePRB(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
    }
 }
 
    }
 }
 
+/**
+ * @brief frequency domain allocation function. 
+ *
+ * @details
+ *
+ *     Function: schCalcTbSize
+ *     
+ *     This function finds the TBSize from table Table 5.1.3.2-1 spec 38.214
+ *     
+ *  @param[in]  payLoadSize - size of payload
+ *  @return     TBsize from the Table
+ **/
+uint16_t schCalcTbSize(uint16_t payLoadSize)
+{
+   uint8_t tbsIndex = 0;
+       payLoadSize = payLoadSize*8;
+
+       while(payLoadSize > tbSizeTable[tbsIndex])
+       {
+          tbsIndex++;
+       }
+
+       /* return the TBsize in bytes */
+       return (tbSizeTable[tbsIndex]/8);
+}
+
+/**
+ * @brief frequency domain allocation function. 
+ *
+ * @details
+ *
+ *     Function: schCalcNumPrb
+ *     
+ *     This function calculates the number of PRbs 
+ *     
+ *  @param[in]  tbSize
+ *  @param[in]  mcs
+ *  @param[in]  number of symbols
+ *  @return   number PRBs
+ **/
+uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
+{
+   uint16_t numPrb = 0;
+   uint16_t nre = 0;
+       uint16_t nreDash = 0;
+       uint8_t  qm     = mcsTable[mcs][1];
+       uint16_t rValue = mcsTable[mcs][2];
+       uint8_t  numLayer = 1;       /* v value */
+       uint8_t numDmrsSymbols = 12; /* considering whole of one symbols with 12 SCs for DMRS */
+
+   /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 *
+    * Ninfo = Nre . R . Qm . v                                       *
+    * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh                       *
+    * Nre = min(156,Nre') . nPrb                                     */
+
+       nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer));
+
+       nreDash = ceil( (12 * numSymbols) - numDmrsSymbols - 0);
+
+       if (nreDash > 156)
+          nre = 156;
+
+   numPrb = ceil((float)nre / nreDash);   
+       return numPrb;
+}
+
 /**********************************************************************
          End of file
 **********************************************************************/
 /**********************************************************************
          End of file
 **********************************************************************/
index 6616e3a..5d86c4e 100644 (file)
@@ -24,7 +24,7 @@
 #define MAX_RACH_NUM_RB_IDX    16
 #define MAX_PRACH_CONFIG_IDX   256
 #define MAX_MU_PUSCH           4
 #define MAX_RACH_NUM_RB_IDX    16
 #define MAX_PRACH_CONFIG_IDX   256
 #define MAX_MU_PUSCH           4
-
+#define TOTAL_TBSIZE_VALUES    93
 #define SET_BITS(_startBit, _numBits, _byte)                                \
 {                                                            \
    _byte = (((~((~0)<<_numBits))<<_startBit));               \
 #define SET_BITS(_startBit, _numBits, _byte)                                \
 {                                                            \
    _byte = (((~((~0)<<_numBits))<<_startBit));               \
diff --git a/src/cm/common_def.h b/src/cm/common_def.h
new file mode 100644 (file)
index 0000000..7ef5121
--- /dev/null
@@ -0,0 +1,20 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* 5G ORAN phy delay */
+#define PHY_DELTA 2
index 3b1c558..907573c 100644 (file)
 #define SIB1_NEW_TX_PERIOD      160
 #define SIB1_REPETITION_PERIOD   20
 #define CORESET_0_INDEX      0
 #define SIB1_NEW_TX_PERIOD      160
 #define SIB1_REPETITION_PERIOD   20
 #define CORESET_0_INDEX      0
+#define CORESET_1_INDEX      1
+#define CORESET_2_INDEX      2
+#define CORESET_3_INDEX      3
+#define CORESET_4_INDEX      4
 #define SEARCHSPACE_0_INDEX   0
 #define SEARCHSPACE_1_INDEX   1
 #define SEARCHSPACE_0_INDEX   0
 #define SEARCHSPACE_1_INDEX   1
+#define SEARCHSPACE_2_INDEX   2
+#define SEARCHSPACE_3_INDEX   3
+#define SEARCHSPACE_4_INDEX   4
 #define SS_MONITORING_SLOT_SL1   0 /* all slots */
 #define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
 #define SIB1_MCS  4
 #define SS_MONITORING_SLOT_SL1   0 /* all slots */
 #define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
 #define SIB1_MCS  4
@@ -225,7 +232,9 @@ typedef struct searchSpaceCfg
 
 typedef struct pdcchConfigCommon
 {
 
 typedef struct pdcchConfigCommon
 {
-   SearchSpaceCfg raSearchSpace;
+   /* only one search space is configured during SIB1 */
+   SearchSpaceCfg commonSearchSpace;
+   uint8_t raSearchSpaceId;
 }PdcchConfigCommon;
 
 typedef struct pdschConfigCommon
 }PdcchConfigCommon;
 
 typedef struct pdschConfigCommon
index be2439c..d870a00 100644 (file)
@@ -1,4 +1,5 @@
 /* header include files (.h) */
 /* header include files (.h) */
+#include "stdbool.h"
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
 #include "envopt.h"        /* environment options */
 #include "envdep.h"        /* environment dependent */
 #include "envind.h"        /* environment independent */
@@ -154,11 +155,11 @@ uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo)
  *     
  *     
  *  @param[in]  Pst *pst, the post structure     
  *     
  *     
  *  @param[in]  Pst *pst, the post structure     
- *  @param[in]  DlAlloc  *dlAlloc
+ *  @param[in]  DlSchedInfo  *dlSchedInfo
  *  @return  S16
  *      -# ROK
  **/
  *  @return  S16
  *      -# ROK
  **/
-int packSchMacDlAlloc(Pst *pst, DlAlloc  *dlAlloc)
+int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
 {
        return ROK;
 }
 {
        return ROK;
 }
@@ -173,11 +174,11 @@ int packSchMacDlAlloc(Pst *pst, DlAlloc  *dlAlloc)
  *     
  *     
  *  @param[in]  Pst *pst, the post structure     
  *     
  *     
  *  @param[in]  Pst *pst, the post structure     
- *  @param[in]  *ulSchInfo, UlSchInfo
+ *  @param[in]  UlSchedInfo *ulSchedInfo
  *  @return  S16
  *      -# ROK
  **/
  *  @return  S16
  *      -# ROK
  **/
-int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo)
+int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
 {
        return ROK;
 }
 {
        return ROK;
 }
index 6fc4caf..78faf02 100644 (file)
 
 #define MAX_NUMBER_OF_CRC_IND_BITS 1
 #define MAX_NUM_LOGICAL_CHANNELS   11
 
 #define MAX_NUMBER_OF_CRC_IND_BITS 1
 #define MAX_NUM_LOGICAL_CHANNELS   11
-
+/* can we have a common numslot numscs between mac sch */
+#define MAX_SLOTS 10
+#define MAX_SFN   1024
 #define CCCH_LCID  0
 #define CCCH_LCID  0
+#define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
+   if ((crntTime.slot + incr) > (MAX_SLOTS - 1))   \
+      toFill.sfn = (crntTime.sfn + 1);      \
+   else                                                  \
+      toFill.sfn = crntTime.sfn;                              \
+   toFill.slot = (crntTime.slot + incr) % MAX_SLOTS; \
+   if (toFill.sfn >= MAX_SFN) \
+   { \
+      toFill.sfn%=MAX_SFN; \
+   } \
 
 /*structures*/
 
 
 /*structures*/
 
@@ -148,7 +160,6 @@ typedef struct pdschCfg
    uint16_t pduBitmap;
    uint16_t rnti;
    uint16_t pduIndex;
    uint16_t pduBitmap;
    uint16_t rnti;
    uint16_t pduIndex;
-   BwpCfg pdschBwpCfg;
    uint8_t numCodewords;
    CodewordInfo codeword[MAX_CODEWORDS];
    uint16_t dataScramblingId;
    uint8_t numCodewords;
    CodewordInfo codeword[MAX_CODEWORDS];
    uint16_t dataScramblingId;
@@ -201,7 +212,6 @@ typedef struct dlDCI
 
 typedef struct pdcchCfg
 {
 
 typedef struct pdcchCfg
 {
-   BwpCfg pdcchBwpCfg;
    /* coreset-0 configuration */
    CoresetCfg coreset0Cfg;
 
    /* coreset-0 configuration */
    CoresetCfg coreset0Cfg;
 
@@ -222,6 +232,7 @@ typedef struct
        
        /* parameters derived in scheduler */
        uint8_t n0;
        
        /* parameters derived in scheduler */
        uint8_t n0;
+   BwpCfg bwp;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 }SchSib1Cfg;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 }SchSib1Cfg;
@@ -271,7 +282,8 @@ typedef struct schSearchSpaceCfg
 
 typedef struct schPdcchCfgCmn
 {
 
 typedef struct schPdcchCfgCmn
 {
-   SchSearchSpaceCfg raSearchSpace;
+   SchSearchSpaceCfg commonSearchSpace;
+   uint8_t raSearchSpaceId;
 }SchPdcchCfgCmn;
 
 typedef struct schPdschCfgCmn
 }SchPdcchCfgCmn;
 
 typedef struct schPdschCfgCmn
@@ -344,6 +356,7 @@ typedef struct ssbInfo
 
 typedef struct sib1AllocInfo
 {
 
 typedef struct sib1AllocInfo
 {
+   BwpCfg bwp;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 } Sib1AllocInfo;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 } Sib1AllocInfo;
@@ -389,6 +402,7 @@ typedef struct rarInfo
 typedef struct rarAlloc
 {
    RarInfo rarInfo;
 typedef struct rarAlloc
 {
    RarInfo rarInfo;
+   BwpCfg  bwp;
    PdcchCfg rarPdcchCfg;
    PdschCfg rarPdschCfg;
 }RarAlloc;
    PdcchCfg rarPdcchCfg;
    PdschCfg rarPdschCfg;
 }RarAlloc;
@@ -410,26 +424,36 @@ typedef struct msg4Info
 typedef struct msg4Alloc
 {
    Msg4Info msg4Info;
 typedef struct msg4Alloc
 {
    Msg4Info msg4Info;
+   BwpCfg bwp;
    PdcchCfg msg4PdcchCfg;
    PdschCfg msg4PdschCfg;
 }Msg4Alloc;
 
    PdcchCfg msg4PdcchCfg;
    PdschCfg msg4PdschCfg;
 }Msg4Alloc;
 
-typedef struct dlAlloc
+typedef struct schSlotValue
+{
+       SlotIndInfo currentTime;
+       SlotIndInfo broadcastTime;
+       SlotIndInfo rarTime;
+       SlotIndInfo msg4Time;
+       SlotIndInfo dlMsgTime;
+}SchSlotValue;
+
+typedef struct dlSchedInfo
 {
    uint16_t cellId;  /* Cell Id */
 {
    uint16_t cellId;  /* Cell Id */
-       SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
+       SchSlotValue schSlotValue;
 
        /* Allocation for broadcast messages */
 
        /* Allocation for broadcast messages */
-   uint8_t isBroadcastPres;
+   bool isBroadcastPres;
        DlBrdcstAlloc brdcstAlloc;
 
        /* Allocation for RAR message */
        DlBrdcstAlloc brdcstAlloc;
 
        /* Allocation for RAR message */
-       uint8_t isRarPres;
-       RarAlloc rarAlloc;
+       //uint8_t isRarPres;
+       RarAlloc *rarAlloc;
 
    /* Allocation from MSG4 */
    Msg4Alloc *msg4Alloc;
 
    /* Allocation from MSG4 */
    Msg4Alloc *msg4Alloc;
-}DlAlloc;
+}DlSchedInfo;
 
 typedef struct tbInfo
 {
 
 typedef struct tbInfo
 {
@@ -449,7 +473,7 @@ typedef struct schPuschInfo
 }SchPuschInfo;
 
 
 }SchPuschInfo;
 
 
-typedef struct ulSchInfo
+typedef struct ulSchedInfo
 {
    uint16_t      cellId;         /* Cell Id */
        uint16_t      crnti;          /* CRNI */
 {
    uint16_t      cellId;         /* Cell Id */
        uint16_t      crnti;          /* CRNI */
@@ -457,7 +481,7 @@ typedef struct ulSchInfo
        uint8_t       dataType;       /* Type of info being scheduled */
        PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
        SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
        uint8_t       dataType;       /* Type of info being scheduled */
        PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
        SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
-}UlSchInfo;
+}UlSchedInfo;
 
 typedef struct rachIndInfo
 {
 
 typedef struct rachIndInfo
 {
@@ -510,28 +534,28 @@ typedef int (*SchCellCfgFunc)    ARGS((
 
 typedef int (*SchMacDlAllocFunc)     ARGS((                     
    Pst            *pst,       /* Post Structure */                         
 
 typedef int (*SchMacDlAllocFunc)     ARGS((                     
    Pst            *pst,       /* Post Structure */                         
-   DlAlloc        *dlAlloc    /* dl allocation Info */                      
+   DlSchedInfo    *dlSchedInfo    /* dl allocation Info */                      
 ));
 
 typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
 ));
 
 typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
-   Pst            *pst,           /* Post Structure */                         
-   UlSchInfo      *ulSchInfo    /* UL Sch  Info */                      
+   Pst         *pst,           /* Post Structure */                         
+   UlSchedInfo *ulSchedInfo         /* UL Alloc Sch  Info */                      
 ));
 
 /* function declarations */
 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
 ));
 
 /* function declarations */
 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
-int packSchMacDlAlloc(Pst *pst, DlAlloc  *dlAlloc);
-int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
+int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
+int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 
 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 
-EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
+EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
-EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
+EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
index 05aefd0..b1ebacb 100644 (file)
@@ -234,22 +234,22 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
    duCfgParam.macCellCfg.initialDlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
    duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
    duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
    duCfgParam.macCellCfg.initialDlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
    duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.coresetId = CORESET_0_INDEX;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot =
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
           SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
           SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.duration = 0;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol =
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
           SS_MONITORING_SYMBOL;
           SS_MONITORING_SYMBOL;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
           candidate.aggLevel1  = 8;
           candidate.aggLevel1  = 8;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
           candidate.aggLevel2  = 4;
           candidate.aggLevel2  = 4;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
           candidate.aggLevel4  = 2;
           candidate.aggLevel4  = 2;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
           candidate.aggLevel8  = 1;
           candidate.aggLevel8  = 1;
-   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
           candidate.aggLevel16 = 0;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0;
        duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
           candidate.aggLevel16 = 0;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0;
        duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
@@ -258,8 +258,9 @@ S16 readMacCfg()
           PDSCH_START_SYMBOL;
        duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
           PDSCH_LENGTH_SYMBOL;
           PDSCH_START_SYMBOL;
        duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
           PDSCH_LENGTH_SYMBOL;
-
-   /* fill Intial DL BWP */
+       /* ra-searchSpace ID is set to 1 */
+   duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
+   /* fill Intial UL BWP */
    duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
    duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
    duCfgParam.macCellCfg.initialUlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
    duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
    duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
    duCfgParam.macCellCfg.initialUlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
index 086cd1e..6a21f11 100644 (file)
@@ -595,7 +595,7 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
    fapi_dl_tti_req_t *dlTtiReq;
    dlTtiReq = (fapi_dl_tti_req_t *)msg;
 
    fapi_dl_tti_req_t *dlTtiReq;
    dlTtiReq = (fapi_dl_tti_req_t *)msg;
 
-   printf("\nPHY STUB: Received DL TTI Request");
+   printf("\nPHY STUB: DL TTI Request at sfn=%d slot=%d",dlTtiReq->sfn,dlTtiReq->slot);
 #if 0
    printf("\nPHY_STUB:  SFN     %d", dlTtiReq->sfn);
    printf("\nPHY_STUB:  SLOT    %d", dlTtiReq->slot);
 #if 0
    printf("\nPHY_STUB:  SFN     %d", dlTtiReq->sfn);
    printf("\nPHY_STUB:  SLOT    %d", dlTtiReq->slot);
@@ -656,7 +656,7 @@ PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
    fapi_tx_data_req_t *txDataReq;
    txDataReq = (fapi_tx_data_req_t *)msg;
 
    fapi_tx_data_req_t *txDataReq;
    txDataReq = (fapi_tx_data_req_t *)msg;
 
-   DU_LOG("\nPHY STUB: Received TX DATA Request");
+   DU_LOG("\nPHY STUB: TX DATA Request at sfn=%d slot=%d",txDataReq->sfn,txDataReq->slot);
 
        MAC_FREE(txDataReq, msgLen);
 #endif
 
        MAC_FREE(txDataReq, msgLen);
 #endif