RARandSib1Transmission 60/3660/3
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Sun, 10 May 2020 18:22:53 +0000 (23:52 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Wed, 13 May 2020 07:20:24 +0000 (12:50 +0530)
Change-Id: I347a3aca4d8945c10db7237ce1d3234bb06454d7
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
18 files changed:
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/lwr_mac_handle_phy.c
src/5gnrmac/mac.h
src/5gnrmac/mac_mux.c
src/5gnrmac/mac_slot_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_rach.c
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_msg_hdl.c
src/phy_stub/l1_bdy1.c

index ba26c40..f32f051 100644 (file)
@@ -79,6 +79,8 @@ extern uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX];
 SlotIndInfo slotIndInfo;
 uint8_t slotIndIdx;
 
 SlotIndInfo slotIndInfo;
 uint8_t slotIndIdx;
 
+uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo);
+
 void lwrMacInit()
 {
 #ifdef INTEL_WLS
 void lwrMacInit()
 {
 #ifdef INTEL_WLS
@@ -111,7 +113,7 @@ void lwrMacInit()
   * ****************************************************************/
 S16 lwr_mac_handleInvalidEvt(void *msg)
 {
   * ****************************************************************/
 S16 lwr_mac_handleInvalidEvt(void *msg)
 {
-  printf("\nLOWER MAC: Error Indication Event[%d] received in state [%d]", clGlobalCp.event, clGlobalCp.phyState);
+  printf("\nLWR_MAC: Error Indication Event[%d] received in state [%d]", clGlobalCp.event, clGlobalCp.phyState);
   RETVALUE(ROK);
 }
 
   RETVALUE(ROK);
 }
 
@@ -1293,7 +1295,7 @@ uint32_t getParamValue(fapi_uint16_tlv_t *tlv, uint16_t type)
     }
     else
     {
     }
     else
     {
-      DU_LOG("\nLOWER MAC: Value Extraction failed" );
+      DU_LOG("\nLWR_MAC: Value Extraction failed" );
       return RFAILED;
     }
 }
       return RFAILED;
     }
 }
@@ -1326,13 +1328,13 @@ S16 lwr_mac_handleParamReqEvt(void *msg)
    if(paramReq != NULLP)
    {
       fillMsgHeader(&paramReq->header, FAPI_PARAM_REQUEST, msgLen);
    if(paramReq != NULLP)
    {
       fillMsgHeader(&paramReq->header, FAPI_PARAM_REQUEST, msgLen);
-      DU_LOG("\nLOWER MAC: Sending Param Request to Phy");
+      DU_LOG("\nLWR_MAC: Sending Param Request to Phy");
       LwrMacSendToPhy(paramReq->header.message_type_id, sizeof(fapi_param_req_t), (void *)paramReq);
       return ROK;
    }
    else
    {
       LwrMacSendToPhy(paramReq->header.message_type_id, sizeof(fapi_param_req_t), (void *)paramReq);
       return ROK;
    }
    else
    {
-      DU_LOG("\nLOWER MAC: Failed to allocate memory for Param Request");
+      DU_LOG("\nLWR_MAC: Failed to allocate memory for Param Request");
       return RFAILED;
    }
 #else
       return RFAILED;
    }
 #else
@@ -1367,14 +1369,14 @@ S16 lwr_mac_handleParamRspEvt(void *msg)
    ClCellParam *cellParam = NULLP;
 
    paramRsp = (fapi_param_resp_t *)msg;
    ClCellParam *cellParam = NULLP;
 
    paramRsp = (fapi_param_resp_t *)msg;
-   DU_LOG("\nLOWER MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
 
    if(paramRsp != NULLP)
    {
       MAC_ALLOC(cellParam, sizeof(ClCellParam));
       if(cellParam != NULLP)
       {
 
    if(paramRsp != NULLP)
    {
       MAC_ALLOC(cellParam, sizeof(ClCellParam));
       if(cellParam != NULLP)
       {
-         DU_LOG("\n LOWER MAC: Filling TLVS into MAC API");
+         DU_LOG("\n LWR_MAC: Filling TLVS into MAC API");
          if(paramRsp->error_code == MSG_OK)
          {
             for(index = 0; index < paramRsp->number_of_tlvs; index++)
          if(paramRsp->error_code == MSG_OK)
          {
             for(index = 0; index < paramRsp->number_of_tlvs; index++)
@@ -1856,19 +1858,19 @@ S16 lwr_mac_handleParamRspEvt(void *msg)
          }
          else
          {
          }
          else
          {
-            DU_LOG("\n LOWER MAC: Invalid error code %d", paramRsp->error_code);
+            DU_LOG("\n LWR_MAC: Invalid error code %d", paramRsp->error_code);
             return RFAILED;
          }
      }
      else
      {
             return RFAILED;
          }
      }
      else
      {
-        DU_LOG("\nLOWER MAC: Failed to allocate memory for cell param");
+        DU_LOG("\nLWR_MAC: Failed to allocate memory for cell param");
         return RFAILED;
      }
    }
    else
    {
         return RFAILED;
      }
    }
    else
    {
-       DU_LOG("\nLOWER MAC:  Param Response received from PHY is NULL");
+       DU_LOG("\nLWR_MAC:  Param Response received from PHY is NULL");
        return RFAILED;
    }
 #else
        return RFAILED;
    }
 #else
@@ -1903,7 +1905,7 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
    MacCellCfg macCfgParams;
    Inst inst = 0;
 
    MacCellCfg macCfgParams;
    Inst inst = 0;
 
-   DU_LOG("\nLOWER MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
 
    fapi_config_req_t *configReq;
    cellParams = rgCb[inst].cell;
 
    fapi_config_req_t *configReq;
    cellParams = rgCb[inst].cell;
@@ -2006,13 +2008,13 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
 #ifdef FAPI
    fapi_config_resp_t *configRsp;
        configRsp = (fapi_config_resp_t *)msg;
 #ifdef FAPI
    fapi_config_resp_t *configRsp;
        configRsp = (fapi_config_resp_t *)msg;
-   DU_LOG("\nLOWER MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
 
    if(configRsp != NULL)
    {
       if(configRsp->error_code == MSG_OK)
       {
 
    if(configRsp != NULL)
    {
       if(configRsp->error_code == MSG_OK)
       {
-         DU_LOG("\nLOWER MAC: PHY has moved to Configured state \n");
+         DU_LOG("\nLWR_MAC: PHY has moved to Configured state \n");
          clGlobalCp.phyState = PHY_STATE_CONFIGURED;
          /* TODO : 
           * Store config response into an intermediate struture and send to MAC
          clGlobalCp.phyState = PHY_STATE_CONFIGURED;
          /* TODO : 
           * Store config response into an intermediate struture and send to MAC
@@ -2024,7 +2026,7 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
       else
       {
 
       else
       {
 
-         DU_LOG("\n LOWER MAC: Invalid error code %d", configRsp->error_code);
+         DU_LOG("\n LWR_MAC: Invalid error code %d", configRsp->error_code);
          return RFAILED;
       }
    }
          return RFAILED;
       }
    }
@@ -2048,13 +2050,13 @@ S16 lwr_mac_handleStartReqEvt(void *msg)
    if(startReq != NULL)
    {
       fillMsgHeader(&startReq->header, FAPI_START_REQUEST, msgLen);
    if(startReq != NULL)
    {
       fillMsgHeader(&startReq->header, FAPI_START_REQUEST, msgLen);
-      DU_LOG("\nLOWER MAC: Sending Start Request to PHY");
+      DU_LOG("\nLWR_MAC: Sending Start Request to PHY");
       LwrMacSendToPhy(startReq->header.message_type_id, sizeof(fapi_start_req_t), (void *)startReq);
       return ROK;
    }
    else
    {
       LwrMacSendToPhy(startReq->header.message_type_id, sizeof(fapi_start_req_t), (void *)startReq);
       return ROK;
    }
    else
    {
-      DU_LOG("\nLOWER MAC: Failed to allocate memory for Start Request");
+      DU_LOG("\nLWR_MAC: Failed to allocate memory for Start Request");
       return RFAILED;
    }
 #else
       return RFAILED;
    }
 #else
@@ -2091,7 +2093,7 @@ PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val)
 {
    *mibPdu |= (((uint8_t)(slotIndInfo.sfn >> 2)) & MIB_SFN_BITMASK);
    *val = (mibPdu[0] << 24 | mibPdu[1] << 16 | mibPdu[2] << 8);
 {
    *mibPdu |= (((uint8_t)(slotIndInfo.sfn >> 2)) & MIB_SFN_BITMASK);
    *val = (mibPdu[0] << 24 | mibPdu[1] << 16 | mibPdu[2] << 8);
-    DU_LOG("\nLOWER MAC: value filled %x", *val);
+    DU_LOG("\nLWR_MAC: MIB PDU %x", *val);
 }
 
 #ifdef FAPI
 }
 
 #ifdef FAPI
@@ -2258,7 +2260,7 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo)
 
      if(numBytes > DCI_PAYLOAD_BYTE_LEN)
      {
 
      if(numBytes > DCI_PAYLOAD_BYTE_LEN)
      {
-        DU_LOG("\nLOWER MAC : Total bytes for DCI is more than expected");
+        DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
         return;
      }
 
         return;
      }
 
@@ -2392,7 +2394,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo)
 
                if(numBytes > DCI_PAYLOAD_BYTE_LEN)
                {
 
                if(numBytes > DCI_PAYLOAD_BYTE_LEN)
                {
-                       DU_LOG("\nLOWER MAC : Total bytes for DCI is more than expected");
+                       DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
                        return;
                }
 
                        return;
                }
 
@@ -2496,7 +2498,7 @@ uint32_t *msgLen)
  ******************************************************************/
 
 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)
+uint32_t *msgLen, uint16_t pduIndex)
 {
     uint8_t idx;
 
 {
     uint8_t idx;
 
@@ -2505,7 +2507,7 @@ uint32_t *msgLen)
        dlTtiReqPdu->pduType = PDSCH_PDU_TYPE;
        dlTtiReqPdu->u.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
        dlTtiReqPdu->u.pdsch_pdu.rnti = pdschInfo->rnti;         
        dlTtiReqPdu->pduType = PDSCH_PDU_TYPE;
        dlTtiReqPdu->u.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
        dlTtiReqPdu->u.pdsch_pdu.rnti = pdschInfo->rnti;         
-       dlTtiReqPdu->u.pdsch_pdu.pduIndex = pdschInfo->pduIndex;
+       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.bwpSize = pdschInfo->pdschBwpCfg.BWPSize;       
        dlTtiReqPdu->u.pdsch_pdu.bwpStart = pdschInfo->pdschBwpCfg.BWPStart;
        dlTtiReqPdu->u.pdsch_pdu.subCarrierSpacing = pdschInfo->pdschBwpCfg.subcarrierSpacing;
@@ -2559,7 +2561,7 @@ uint32_t *msgLen)
  *
  * @details
  *
  *
  * @details
  *
- *    Function : calculatePduCount
+ *    Function : calcDlTtiReqPduCount
  *
  *    Functionality:
  *         -calculates the total pdu count to be allocated for DL TTI Req
  *
  *    Functionality:
  *         -calculates the total pdu count to be allocated for DL TTI Req
@@ -2568,7 +2570,7 @@ uint32_t *msgLen)
  * @return count
  *
  * ********************************************************************/
  * @return count
  *
  * ********************************************************************/
-uint8_t calculatePduCount(DlAlloc *dlInfo)
+uint8_t calcDlTtiReqPduCount(DlAlloc *dlInfo)
 {
    uint8_t count = 0;
    uint8_t idx = 0;
 {
    uint8_t count = 0;
    uint8_t idx = 0;
@@ -2593,6 +2595,34 @@ uint8_t calculatePduCount(DlAlloc *dlInfo)
    return count;
 }
 
    return count;
 }
 
+/***********************************************************************
+ *
+ * @brief calculates the total size to be allocated for DL TTI Req
+ *
+ * @details
+ *
+ *    Function : calcTxDataReqPduCount
+ *
+ *    Functionality:
+ *         -calculates the total pdu count to be allocated for DL TTI Req
+ *
+ * @params[in]    DlBrdcstAlloc *cellBroadcastInfo
+ * @return count
+ *
+ * ********************************************************************/
+uint8_t calcTxDataReqPduCount(DlAlloc *dlInfo)
+{
+   uint8_t count = 0;
+       if(dlInfo->isBroadcastPres && dlInfo->brdcstAlloc.sib1Trans)
+       {
+         count++;
+   }
+       if(dlInfo->isRarPres)
+       {
+          count++;
+       }
+   return count;
+}
 /***********************************************************************
  *
  * @brief fills the SIB1 TX-DATA request message
 /***********************************************************************
  *
  * @brief fills the SIB1 TX-DATA request message
@@ -2605,14 +2635,14 @@ uint8_t calculatePduCount(DlAlloc *dlInfo)
  *         - fills the SIB1 TX-DATA request message
  *
  * @params[in]    fapi_tx_pdu_desc_t *pduDesc
  *         - fills the SIB1 TX-DATA request message
  *
  * @params[in]    fapi_tx_pdu_desc_t *pduDesc
- * @params[in]    MacCellCfg *macCellCfg
- * @params[in]    uint16_t pduIndex
+ * @params[in]    macCellCfg consist of SIB1 pdu
  * @params[in]    uint32_t *msgLen
  * @params[in]    uint32_t *msgLen
+ * @params[in]    uint16_t pduIndex
  * @return ROK
  *
  * ********************************************************************/
 uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
  * @return ROK
  *
  * ********************************************************************/
 uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
-   uint16_t pduIndex, uint32_t *msgLen)
+   uint32_t *msgLen, uint16_t pduIndex)
 {
    uint32_t pduLen = 0;
        uint32_t *sib1TxdataValue = NULLP;
 {
    uint32_t pduLen = 0;
        uint32_t *sib1TxdataValue = NULLP;
@@ -2660,13 +2690,13 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
  *
  * @params[in]    fapi_tx_pdu_desc_t *pduDesc
  * @params[in]    RarInfo *rarInfo
  *
  * @params[in]    fapi_tx_pdu_desc_t *pduDesc
  * @params[in]    RarInfo *rarInfo
- * @params[in]    uint16_t pduIndex
  * @params[in]    uint32_t *msgLen
  * @params[in]    uint32_t *msgLen
+ * @params[in]    uint16_t pduIndex
  * @return ROK
  *
  * ********************************************************************/
 uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
  * @return ROK
  *
  * ********************************************************************/
 uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
-   uint16_t pduIndex, uint32_t *msgLen)
+   uint32_t *msgLen, uint16_t pduIndex)
 {
    uint32_t pduLen = 0;
        uint32_t *rarTxdataValue = NULLP;
 {
    uint32_t pduLen = 0;
        uint32_t *rarTxdataValue = NULLP;
@@ -2713,22 +2743,22 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
  *    Function : handleDlTtiReq
  *
  *    Functionality:
  *    Function : handleDlTtiReq
  *
  *    Functionality:
- *         -Sends FAPI Param req to PHY
+ *         -Sends FAPI DL TTI req to PHY
  *
  *
- * @params[in]    RgDlSf *dlTtiReqSlot
+ * @params[in]    timing info
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
+uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo)
 {
 #ifdef FAPI
        uint8_t idx;
        uint8_t nPdu = 0;
        uint8_t numPduEncoded = 0;
 {
 #ifdef FAPI
        uint8_t idx;
        uint8_t nPdu = 0;
        uint8_t numPduEncoded = 0;
+       uint16_t pduIndex = 0;
        uint32_t msgLen = 0;
        fapi_dl_tti_req_t *dlTtiReq = NULLP;
        uint32_t msgLen = 0;
        fapi_dl_tti_req_t *dlTtiReq = NULLP;
-       fapi_tx_data_req_t *txDataReq = NULLP;
        RgCellCb  *cellCbParams = NULLP;
        MacDlSlot *currDlSlot = NULLP;
        MacCellCfg macCellCfg;
        RgCellCb  *cellCbParams = NULLP;
        MacDlSlot *currDlSlot = NULLP;
        MacCellCfg macCellCfg;
@@ -2740,15 +2770,15 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                cellCbParams = rgCb[inst].cell;
                macCellCfg = cellCbParams->macCellCfg;
 
                cellCbParams = rgCb[inst].cell;
                macCellCfg = cellCbParams->macCellCfg;
 
-               if(dlTtiReqtimingInfo != NULLP)
+               if(currTimingInfo != NULLP)
                {
                   LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
                        if(dlTtiReq != NULLP)
                        {
                {
                   LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
                        if(dlTtiReq != NULLP)
                        {
-                               dlTtiReq->sfn = dlTtiReqtimingInfo->sfn;
-                               dlTtiReq->slot = dlTtiReqtimingInfo->slot;
+                               dlTtiReq->sfn = currTimingInfo->sfn;
+                               dlTtiReq->slot = currTimingInfo->slot;
                                currDlSlot = &macCb.macCell->dlSlot[dlTtiReq->slot % MAX_SLOT_SUPPORTED];
                                currDlSlot = &macCb.macCell->dlSlot[dlTtiReq->slot % MAX_SLOT_SUPPORTED];
-                               dlTtiReq->nPdus = calculatePduCount(&currDlSlot->dlInfo);  /* get total Pdus */
+                               dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
                                nPdu = dlTtiReq->nPdus;
                                dlTtiReq->nGroup = 0;
                                if(dlTtiReq->nPdus > 0)
                                nPdu = dlTtiReq->nPdus;
                                dlTtiReq->nGroup = 0;
                                if(dlTtiReq->nPdus > 0)
@@ -2756,7 +2786,7 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                                   LWR_MAC_ALLOC(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
                if(!dlTtiReq->pdus)
                {
                                   LWR_MAC_ALLOC(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
                if(!dlTtiReq->pdus)
                {
-                  DU_LOG("\nLOWER MAC: Memory allocation failed");
+                  DU_LOG("\nLWR_MAC: Memory allocation failed");
                   return RFAILED;
                }
           
                   return RFAILED;
                }
           
@@ -2774,7 +2804,9 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                                                                        numPduEncoded++;
                                                                }
                                                        }
                                                                        numPduEncoded++;
                                                                }
                                                        }
-                                                       DU_LOG("\nLOWER MAC: MIB sent..");
+                                                       printf("\033[1;31m");
+                                                       DU_LOG("\nLWR_MAC: MIB sent..");
+                                                       printf("\033[0m");
                                                }
                                                if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
                                                {
                                                }
                                                if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
                                                {
@@ -2785,20 +2817,29 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                                                                                sib1Alloc.sib1PdcchCfg, &msgLen);
                                                                numPduEncoded++;
                                                                fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo.brdcstAlloc.\
                                                                                sib1Alloc.sib1PdcchCfg, &msgLen);
                                                                numPduEncoded++;
                                                                fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo.brdcstAlloc.\
-                                                                               sib1Alloc.sib1PdschCfg, &msgLen);
+                                                                               sib1Alloc.sib1PdschCfg, &msgLen, pduIndex);
+                                                               pduIndex++;
                                                                numPduEncoded++;
                                                        }
                                                                numPduEncoded++;
                                                        }
-                                                       DU_LOG("\nLOWER MAC: SIB1 sent...");
+                                                       printf("\033[1;34m");
+                                                       DU_LOG("\nLWR_MAC: SIB1 sent...");
+                                                       printf("\033[0m");
                                                }
                                        }
                                        if(currDlSlot->dlInfo.isRarPres)
                                        {
                                                /* Filling RAR param */
                                                }
                                        }
                                        if(currDlSlot->dlInfo.isRarPres)
                                        {
                                                /* Filling RAR param */
+                                fillRarPdu(&currDlSlot->dlInfo.rarAlloc.rarInfo);
                                                fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.rarAlloc.rarPdcchCfg, &msgLen);
                                                numPduEncoded++;
                                                fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.rarAlloc.rarPdcchCfg, &msgLen);
                                                numPduEncoded++;
-                                               fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.rarAlloc.rarPdschCfg, &msgLen);
+                                               fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.rarAlloc.rarPdschCfg,
+                                                  &msgLen, pduIndex);
                                                numPduEncoded++;
                                                numPduEncoded++;
-                                               DU_LOG("\nLOWER MAC: RAR sent...");
+                                               pduIndex++;
+
+                                               printf("\033[1;32m");
+                                               DU_LOG("\nLWR_MAC: RAR sent...");
+                                               printf("\033[0m");
                                        }
 
                                        msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
                                        }
 
                                        msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
@@ -2806,44 +2847,8 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                                        /* TODO : Recheck the size / msglen to be sent to WLS_Put*/
                                        LwrMacSendToPhy(dlTtiReq->header.message_type_id, msgLen, (void *)dlTtiReq);
 
                                        /* TODO : Recheck the size / msglen to be sent to WLS_Put*/
                                        LwrMacSendToPhy(dlTtiReq->header.message_type_id, msgLen, (void *)dlTtiReq);
 
-               /* send TX_Data request message */
-               if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-               {
-                  msgLen = 0;
-                  LWR_MAC_ALLOC(txDataReq,sizeof(fapi_tx_data_req_t));
-                  txDataReq->sfn = dlTtiReqtimingInfo->sfn;
-                  txDataReq->slot = dlTtiReqtimingInfo->slot;
-                  txDataReq->numPdus = 1;
-                                               LWR_MAC_ALLOC(txDataReq->pduDesc, (txDataReq->numPdus * \
-                                               sizeof(fapi_tx_pdu_desc_t)));
-                  fillSib1TxDataReq(
-                        txDataReq->pduDesc,
-                        &rgCb[inst].cell->macCellCfg,
-                        currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg.pduIndex,
-                        &msgLen);
-                  msgLen += sizeof(fapi_tx_data_req_t) - sizeof(fapi_msg_t);
-                  fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
-                  LwrMacSendToPhy(txDataReq->header.message_type_id, msgLen,(void *)txDataReq);
-               }
-               if(currDlSlot->dlInfo.isRarPres)
-               {
-                  msgLen = 0;
-                                               /* mux and form RAR pdu */
-                                               fillRarPdu(&currDlSlot->dlInfo.rarAlloc.rarInfo);
-                  LWR_MAC_ALLOC(txDataReq,sizeof(fapi_tx_data_req_t));
-                  txDataReq->sfn = dlTtiReqtimingInfo->sfn;
-                  txDataReq->slot = dlTtiReqtimingInfo->slot;
-                  txDataReq->numPdus = 1;
-                                               LWR_MAC_ALLOC(txDataReq->pduDesc, (txDataReq->numPdus * \
-                                                  sizeof(fapi_tx_pdu_desc_t)));
-                  fillRarTxDataReq(
-                        txDataReq->pduDesc,
-                        &currDlSlot->dlInfo.rarAlloc.rarInfo,
-                        currDlSlot->dlInfo.rarAlloc.rarPdschCfg.pduIndex,
-                        &msgLen);
-                  fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
-                  LwrMacSendToPhy(txDataReq->header.message_type_id, msgLen,(void *)txDataReq);
-               }
+                                       /* send Tx-DATA req message */
+                                       sendTxDataReq(currTimingInfo, &currDlSlot->dlInfo);
                                }
                                else
                                {
                                }
                                else
                                {
@@ -2856,24 +2861,94 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                        }
                        else
                        {
                        }
                        else
                        {
-                               DU_LOG("\nLOWER MAC: Failed to allocate memory for DL TTI Request");
+                               DU_LOG("\nLWR_MAC: Failed to allocate memory for DL TTI Request");
                                return RFAILED;
                        }
                }
       else
       {
                                return RFAILED;
                        }
                }
       else
       {
-         DU_LOG("\nLOWER MAC: Current TTI Info is NULL");
+         DU_LOG("\nLWR_MAC: Current TTI Info is NULL");
          return RFAILED;
       }
    }
    else
    {
          return RFAILED;
       }
    }
    else
    {
-       lwr_mac_handleInvalidEvt(dlTtiReqtimingInfo);
+       lwr_mac_handleInvalidEvt(currTimingInfo);
+                return RFAILED;
    }
 #endif
    return ROK;
 }
 
    }
 #endif
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Sends TX data Request to PHY
+ *
+ * @details
+ *
+ *    Function : sendTxDataReq
+ *
+ *    Functionality:
+ *         -Sends FAPI TX data req to PHY
+ *
+ * @params[in]    timing info
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t sendTxDataReq(CmLteTimingInfo *currTimingInfo, DlAlloc *dlInfo)
+{
+#ifdef FAPI
+       uint8_t nPdu = 0;
+       uint32_t msgLen = 0;
+   uint16_t pduIndex = 0;
+       fapi_tx_data_req_t *txDataReq = NULLP;
+       Inst inst = 0;
+
+       /* send TX_Data request message */
+       nPdu = calcTxDataReqPduCount(dlInfo);
+       if(nPdu > 0)
+       {
+      LWR_MAC_ALLOC(txDataReq,sizeof(fapi_tx_data_req_t));
+               if(txDataReq == NULLP)
+               {
+                       DU_LOG("\nLWR_MAC: Failed to allocate memory for TX data Request");
+                       return RFAILED;
+               }
+               txDataReq->sfn = currTimingInfo->sfn;
+               txDataReq->slot = currTimingInfo->slot;
+      LWR_MAC_ALLOC(txDataReq->pduDesc,nPdu*sizeof(fapi_tx_pdu_desc_t));
+               if(txDataReq->pduDesc == NULLP)
+               {
+                       DU_LOG("\nLWR_MAC: Failed to allocate memory for pduDesc TX data Request");
+                       return RFAILED;
+               }
+
+               if(dlInfo->brdcstAlloc.sib1Trans)
+               {
+                       fillSib1TxDataReq(txDataReq->pduDesc,
+                                       &rgCb[inst].cell->macCellCfg, &msgLen, pduIndex);
+                       pduIndex++;
+                       txDataReq->numPdus++;
+               }
+               if(dlInfo->isRarPres)
+               {
+                       /* mux and form RAR pdu */
+                       //fillRarPdu(&dlInfo->rarAlloc.rarInfo);
+                       fillRarTxDataReq(txDataReq->pduDesc,
+                                       &dlInfo->rarAlloc.rarInfo, &msgLen, pduIndex);
+                       pduIndex++;
+                       txDataReq->numPdus++;
+               }
+
+               msgLen += sizeof(fapi_tx_data_req_t) - sizeof(fapi_msg_t);
+               fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
+               LwrMacSendToPhy(txDataReq->header.message_type_id, msgLen,(void *)txDataReq);
+       }
+#endif
+       return ROK;
+}
+
 /***********************************************************************
  *
  * @brief calculates the total size to be allocated for UL TTI Req
 /***********************************************************************
  *
  * @brief calculates the total size to be allocated for UL TTI Req
@@ -3005,7 +3080,7 @@ void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
  *         RFAILED - failure
  *
  ******************************************************************/
  *         RFAILED - failure
  *
  ******************************************************************/
-S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
+uint16_t handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
 {
 #ifdef FAPI
    uint32_t msgLen = 0;
 {
 #ifdef FAPI
    uint32_t msgLen = 0;
@@ -3046,7 +3121,7 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
                  }
                  msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
                  fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
                  }
                  msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
                  fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
-                 DU_LOG("\nLOWER MAC: Sending UL TTI Request");
+                 DU_LOG("\nLWR_MAC: Sending UL TTI Request");
                  LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
                }
             } 
                  LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
                }
             } 
@@ -3054,20 +3129,20 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
             {
                 msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
                 fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
             {
                 msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
                 fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
-                DU_LOG("\nLOWER MAC: Sending UL TTI Request");
+                DU_LOG("\nLWR_MAC: Sending UL TTI Request");
                 LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
             }
                                return ROK;
          }
              else
              {
                 LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
             }
                                return ROK;
          }
              else
              {
-                DU_LOG("\nLOWER MAC: Failed to allocate memory for UL TTI Request");
+                DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
             return RFAILED;
          }
       }
       else
       {
             return RFAILED;
          }
       }
       else
       {
-         DU_LOG("\nLOWER MAC: Current TTI Info in UL is NULL");
+         DU_LOG("\nLWR_MAC: Current TTI Info in UL is NULL");
          return RFAILED;
       }
    }
          return RFAILED;
       }
    }
@@ -3109,7 +3184,7 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
 
 /*******************************************************************
  *
 
 /*******************************************************************
  *
- * @brief Sends message to Lower Mac Fsm Event Handler
+ * @brief Sends message to LWR_MAC Fsm Event Handler
  *
  * @details
  *
  *
  * @details
  *
index 7c8b0d8..d1f625d 100644 (file)
@@ -38,9 +38,9 @@ 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 *dlTtiReqtimingInfo);
+uint16_t handleDlTtiReq(CmLteTimingInfo *currTimingInfo);
+uint16_t handleUlTtiReq(CmLteTimingInfo *currTimingInfo);
 void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
-S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo);
 
 typedef S16 (*lwrMacFsmHdlr)(void *);
 #endif
 
 typedef S16 (*lwrMacFsmHdlr)(void *);
 #endif
index 59301a8..a85b861 100644 (file)
@@ -210,7 +210,7 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
       {
          if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
          {
       {
          if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
          {
-            DU_LOG("\nLOWER MAC: PHY has moved to running state");
+            DU_LOG("\nLWR_MAC: PHY has moved to running state");
             clGlobalCp.phyState = PHY_STATE_RUNNING;
          }
 
             clGlobalCp.phyState = PHY_STATE_RUNNING;
          }
 
index b5dd425..43d1e10 100644 (file)
@@ -56,7 +56,6 @@
 typedef struct macDlSlot
 {
    DlAlloc dlInfo;
 typedef struct macDlSlot
 {
    DlAlloc dlInfo;
-
 }MacDlSlot;
 
 typedef struct macUlSlot
 }MacDlSlot;
 
 typedef struct macUlSlot
@@ -81,6 +80,7 @@ typedef struct macCb
 /* global variable */
 EXTERN MacCb macCb;
 void fillMacToSchPst(Pst *pst);
 /* global variable */
 EXTERN MacCb macCb;
 void fillMacToSchPst(Pst *pst);
+void fillRarPdu(RarInfo *rarInfo);
 
 #endif
 /**********************************************************************
 
 #endif
 /**********************************************************************
index d9321f4..668de93 100644 (file)
 #include "mac.h"
 #include "rg.x"            /* typedefs for MAC */
 
 #include "mac.h"
 #include "rg.x"            /* typedefs for MAC */
 
+/*******************************************************************
+ *
+ * @brief pack the bits
+ *
+ * @details
+ *
+ *    Function : packBytes
+ *
+ *    Functionality:
+ *     pack the bits in the corresponding byte
+ *
+ * @params[in] buffer pointer, byte and bit position, value and its size
+ * @return void
+ *
+ * ****************************************************************/
 void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize)
 {
    uint32_t  temp;
 void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize)
 {
    uint32_t  temp;
@@ -98,29 +113,48 @@ void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, ui
    }  
 }
 
    }  
 }
 
+/*******************************************************************
+ *
+ * @brief fill the RAR PDU
+ *
+ * @details
+ *
+ *    Function : fillRarPdu
+ *
+ *    Functionality:
+ *     The RAR PDU will be MUXed and formed
+ *
+ * @params[in] RAR info
+ * @return void
+ *
+ * ****************************************************************/
 void fillRarPdu(RarInfo *rarInfo)
 {
    uint8_t   *rarPdu = rarInfo->rarPdu;
 void fillRarPdu(RarInfo *rarInfo)
 {
    uint8_t   *rarPdu = rarInfo->rarPdu;
-   uint16_t  totalBits;
-   uint8_t   numBytes;
-   uint8_t   bytePos;
-   uint8_t   bitPos;
+   uint16_t  totalBits = 0;
+   uint8_t   numBytes = 0;
+   uint8_t   bytePos= 0;
+   uint8_t   bitPos = 0;
 
    /* RAR subheader fields */
 
    /* RAR subheader fields */
-   uint8_t   EBit;
-   uint8_t   TBit;
-   uint8_t   rapId;
+   uint8_t   EBit = 0;
+   uint8_t   TBit = 0;
+   uint8_t   rapId = 0;
 
    /* RAR payload fields */
 
    /* RAR payload fields */
-   uint8_t   RBit;
-   uint16_t  timeAdv;
-   uint32_t  ulGrant;
-   uint16_t  tmpCrnti; 
+   uint8_t   RBit = 0;
+   uint16_t  timeAdv = 0;
+   uint32_t  ulGrant = 0;
+   uint16_t  tmpCrnti = 0; 
+       uint8_t   paddingLcid = 63;
 
    /* Size(in bits) of RAR subheader files */
    uint8_t   EBitSize = 1;
    uint8_t   TBitSize = 1;
    uint8_t   rapidSize = 6;
 
    /* Size(in bits) of RAR subheader files */
    uint8_t   EBitSize = 1;
    uint8_t   TBitSize = 1;
    uint8_t   rapidSize = 6;
+       uint8_t   paddingLcidSize = 6;
+       uint8_t   paddingSize = 8;
+
 
    /* Size(in bits) of RAR payload fields */
    uint8_t   RBitSize = 1;
 
    /* Size(in bits) of RAR payload fields */
    uint8_t   RBitSize = 1;
@@ -141,6 +175,9 @@ void fillRarPdu(RarInfo *rarInfo)
    /* Calulating total number of bytes in buffer */
    totalBits = EBitSize + TBitSize + rapidSize + RBitSize + timeAdvSize \
      + ulGrantSize + tmpCrntiSize;
    /* Calulating total number of bytes in buffer */
    totalBits = EBitSize + TBitSize + rapidSize + RBitSize + timeAdvSize \
      + ulGrantSize + tmpCrntiSize;
+
+   /* add padding size */
+       totalBits += RBitSize*2 + paddingLcidSize + paddingSize;
    
    /* Calulating total number of bytes in buffer */
    numBytes = totalBits/8;
    
    /* Calulating total number of bytes in buffer */
    numBytes = totalBits/8;
@@ -164,6 +201,12 @@ void fillRarPdu(RarInfo *rarInfo)
    packBytes(rarPdu, &bytePos, &bitPos, timeAdv, timeAdvSize);
    packBytes(rarPdu, &bytePos, &bitPos, ulGrant, ulGrantSize);
    packBytes(rarPdu, &bytePos, &bitPos, tmpCrnti, tmpCrntiSize);
    packBytes(rarPdu, &bytePos, &bitPos, timeAdv, timeAdvSize);
    packBytes(rarPdu, &bytePos, &bitPos, ulGrant, ulGrantSize);
    packBytes(rarPdu, &bytePos, &bitPos, tmpCrnti, tmpCrntiSize);
+
+       /* padding of 2 bytes */
+   packBytes(rarPdu, &bytePos, &bitPos, RBit, RBitSize*2);
+   packBytes(rarPdu, &bytePos, &bitPos, paddingLcid, paddingLcidSize);
+   packBytes(rarPdu, &bytePos, &bitPos, 0, paddingSize);
+       
 }
 
 /**********************************************************************
 }
 
 /**********************************************************************
index e80cb22..e502fbb 100644 (file)
 #include "lrg.x"
 #include "du_app_mac_inf.h"
 #include "mac.h"
 #include "lrg.x"
 #include "du_app_mac_inf.h"
 #include "mac.h"
+#include "du_log.h"
 
 
+/**
+ * @brief process DL allocation from scheduler
+ *
+ * @details
+ *
+ *     Function : MacProcDlAlloc 
+ *      
+ *      This function copied dl sch info in the mac slot info
+ *           
+ *  @param[in]  Pst            *pst
+ *  @param[in]  DL allocation from scheduler
+ *  @return  S16
+ *      -# ROK 
+ *      -# RFAILED 
+ **/
 int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc)
 {
    if(dlAlloc != NULLP)
 int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc)
 {
    if(dlAlloc != NULLP)
@@ -53,6 +69,67 @@ int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc)
    return ROK;
 }
 
    return ROK;
 }
 
+/**
+ * @brief Transmission time interval indication from PHY.
+ *
+ * @details
+ *
+ *     Function : fapiMacSlotInd 
+ *      
+ *      This API is invoked by PHY to indicate TTI indication to MAC for a cell.
+ *           
+ *  @param[in]  Pst            *pst
+ *  @param[in]  SuId           suId 
+ *  @param[in]  SlotIndInfo    *slotInd
+ *  @return  S16
+ *      -# ROK 
+ *      -# RFAILED 
+ **/
+PUBLIC S16 fapiMacSlotInd 
+(
+Pst                 *pst, 
+SlotIndInfo         *slotInd
+)
+{
+   S16              ret;
+   VOLATILE U32     startTime=0;
+   Inst             inst;
+
+   DU_LOG("\nMAC : Slot Indication received");
+   
+   inst = pst->dstInst;
+   /*starting Task*/
+   SStartTask(&startTime, PID_MAC_TTI_IND);
+
+   /* send slot indication to scheduler */
+   ret = sendSlotIndMacToSch(slotInd);
+   if(ret != ROK)
+   {
+      DU_LOG("\nMAC : Sending of slot ind msg from MAC to SCH failed");
+      RETVALUE(ret);
+   }
+
+   ret = macProcessSlotInd(inst,*slotInd);
+   if(ret != ROK)
+   {
+      DU_LOG("\nMAC : macProcessSlotInd failed");
+      RETVALUE(ret);
+   }
+
+   /* send slot indication to du app */
+   ret = sendSlotIndMacToDuApp(slotInd);
+   if(ret != ROK)
+   {
+      DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed");
+      RETVALUE(ret);
+   }
+
+   /*stoping Task*/
+   SStopTask(startTime, PID_MAC_TTI_IND);
+
+   RETVALUE(ret);
+}  /* fapiMacSlotInd */
+
 /**********************************************************************
   End of file
  **********************************************************************/
 /**********************************************************************
   End of file
  **********************************************************************/
index 6c7582e..d710c4f 100755 (executable)
@@ -740,69 +740,6 @@ int sendSlotIndMacToDuApp(SlotIndInfo *slotInd)
    return ret;
 }
 
    return ret;
 }
 
-/**
- * @brief Transmission time interval indication from PHY.
- *
- * @details
- *
- *     Function : fapiMacSlotInd 
- *      
- *      This API is invoked by PHY to indicate TTI indication to MAC for a cell.
- *           
- *  @param[in]  Pst            *pst
- *  @param[in]  SuId           suId 
- *  @param[in]  SlotIndInfo    *slotInd
- *  @return  S16
- *      -# ROK 
- *      -# RFAILED 
- **/
-PUBLIC S16 fapiMacSlotInd 
-(
-Pst                 *pst, 
-SlotIndInfo         *slotInd
-)
-{
-   S16              ret;
-   VOLATILE U32     startTime=0;
-   Inst             inst;
-
-   DU_LOG("\nMAC : Slot Indication received");
-   
-   RG_IS_INST_VALID(pst->dstInst);
-   inst = pst->dstInst - RG_INST_START;
-   /*starting Task*/
-   SStartTask(&startTime, PID_MAC_TTI_IND);
-
-   /* send slot indication to scheduler */
-   ret = sendSlotIndMacToSch(slotInd);
-   if(ret != ROK)
-   {
-      DU_LOG("\nMAC : Sending of slot ind msg from MAC to SCH failed");
-      RETVALUE(ret);
-   }
-
-   /* Now call the TOM (Tfu ownership module) primitive to process further */
-   ret = macProcessSlotInd(inst,*slotInd);
-   if(ret != ROK)
-   {
-      DU_LOG("\nMAC : macProcessSlotInd failed");
-      RETVALUE(ret);
-   }
-
-   /* send slot indication to du app */
-   ret = sendSlotIndMacToDuApp(slotInd);
-   if(ret != ROK)
-   {
-      DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed");
-      RETVALUE(ret);
-   }
-
-   /*stoping Task*/
-   SStopTask(startTime, PID_MAC_TTI_IND);
-
-   RETVALUE(ret);
-}  /* fapiMacSlotInd */
-
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
  /**
  * @brief Transmission of non-rt indication from CL.
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
  /**
  * @brief Transmission of non-rt indication from CL.
index d5176f1..2943511 100755 (executable)
@@ -2217,6 +2217,21 @@ int MacSchCellCfgReq
        schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
        schCellCfg.schRachCfg.raRspWindow   = macCellCfg->prachCfg.raRspWindow;
 
        schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
        schCellCfg.schRachCfg.raRspWindow   = macCellCfg->prachCfg.raRspWindow;
 
+   /* fill initial DL BWP */
+   schCellCfg.schInitialBwp.bwp.firstPrb = macCellCfg->initialBwp.bwp.firstPrb;
+   schCellCfg.schInitialBwp.bwp.numPrb = macCellCfg->initialBwp.bwp.numPrb;
+   schCellCfg.schInitialBwp.bwp.scs = macCellCfg->initialBwp.bwp.scs;
+   schCellCfg.schInitialBwp.bwp.cyclicPrefix = macCellCfg->initialBwp.bwp.cyclicPrefix;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.searchSpaceId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.searchSpaceId;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.coresetId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.coresetId;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSlot = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSlot;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.duration = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.duration;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSymbol = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSymbol;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8;
+   schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16;
 
    cfgPst.srcProcId = pst->dstProcId;
        cfgPst.dstProcId = pst->srcProcId;
 
    cfgPst.srcProcId = pst->dstProcId;
        cfgPst.dstProcId = pst->srcProcId;
index e4f3127..f18947b 100755 (executable)
@@ -613,10 +613,13 @@ SlotIndInfo slotInd
    }
 #endif
 
    }
 #endif
 
-/* Trigger for DL TTI REQ */
    CmLteTimingInfo   timingInfo;
    RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DELTA);
    CmLteTimingInfo   timingInfo;
    RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DELTA);
+
+   /* Trigger for DL TTI REQ */
    handleDlTtiReq(&timingInfo);
    handleDlTtiReq(&timingInfo);
+
+   /* Trigger for UL TTI REQ */
    handleUlTtiReq(&timingInfo);
 
    dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
    handleUlTtiReq(&timingInfo);
 
    dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
index d401bc5..e9cd498 100644 (file)
@@ -509,7 +509,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;
+      pdsch->codeword[cwCount].tbSize = 768/8; /* 38.214: Table 5.1.3.2-1,
+                  devided by 8 to get the value in bytes */
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
index f4b57b2..8bb3fa3 100644 (file)
 #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 SCH_MAX_UE 512
+#define RAR_DELAY   1
+#define SCH_MAX_UE  1
 #define SI_RNTI 0xFFFF
 #define SI_RNTI 0xFFFF
-#define P_RNIT  0xFFFE
+#define P_RNTI  0xFFFE
 
 /* allocate and zero out a static buffer */
 #define SCH_ALLOC(_datPtr, _size)                                \
 
 /* allocate and zero out a static buffer */
 #define SCH_ALLOC(_datPtr, _size)                                \
@@ -66,7 +67,7 @@
    _rspPst.dstInst   = 0;\
        _rspPst.selector  = MAC_SELECTOR_TC;\
 }      
    _rspPst.dstInst   = 0;\
        _rspPst.selector  = MAC_SELECTOR_TC;\
 }      
-extern int schProcessRachInd(RachIndInfo *rachInd, Inst schInst);
+extern uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst);
 /**
   * @brief
   * Structure holding LTE MAC's General Configuration information.
 /**
   * @brief
   * Structure holding LTE MAC's General Configuration information.
index 6ff50ac..62d38e8 100644 (file)
@@ -67,6 +67,20 @@ extern SchCb schCb[SCH_MAX_INST];
 extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4];
 extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4];
 
 extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4];
 extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4];
 
+/**
+ * @brief calculate ra-rnti function. 
+ *
+ * @details
+ *
+ *     Function : calculateRaRnti
+ *     
+ *     This function calculates ra-rnti
+ *     
+ *  @param[in]  symbol index
+ *  @param[in]  slot index
+ *  @param[in]  frequency index
+ *  @return  ra-rnti
+ **/
 uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx)
 {
    uint16_t raRnti = 0;
 uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx)
 {
    uint16_t raRnti = 0;
@@ -75,47 +89,50 @@ uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx)
        return raRnti;
 }
 
        return raRnti;
 }
 
+/**
+ * @brief create raCb function. 
+ *
+ * @details
+ *
+ *     Function : createSchRaCb
+ *     
+ *     This function create raCb
+ *     
+ *  @param[in]  tcrnti
+ *  @param[in]  shed instance
+ *  @return  void
+ **/
 void createSchRaCb(uint16_t tcrnti, Inst schInst)
 {
        schCb[schInst].cells[schInst]->raCb[0].tcrnti = tcrnti;
 }
 
 void createSchRaCb(uint16_t tcrnti, Inst schInst)
 {
        schCb[schInst].cells[schInst]->raCb[0].tcrnti = tcrnti;
 }
 
-int schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
+/**
+ * @brief process rach indication function. 
+ *
+ * @details
+ *
+ *     Function : schProcessRachInd
+ *     
+ *     This function process rach indication
+ *     
+ *  @param[in]  rachInd parameters
+ *  @param[in]  shed instance
+ *  @return  ROK
+ **/
+uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
 {
    SchCellCb *cell = schCb[schInst].cells[schInst];
 {
    SchCellCb *cell = schCb[schInst].cells[schInst];
+       uint16_t raRnti = 0;
 
 
-       uint16_t sfn  = rachInd->timingInfo.sfn;  /* get the current timing info */
-       uint16_t slot = rachInd->timingInfo.slot;
-       uint16_t sfnSlot = ((sfn * 10) + slot + 1); /* scheduled in the next slot */
-       uint8_t rarDelay = 0;
-
-       if(sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0)
-       {
-          /* the next slot has SIB1 occasion, so send it after 2 slot */
-          rarDelay = 2;
-       }
-       else
-       {
-          /* send RAR in the next slot */
-          //rarDelay = 1;
-               rarDelay = 2;
-       }
-
-       if((slot+rarDelay) % SCH_NUM_SLOTS == 0)
-       {
-          sfn = (sfn+1) % SCH_MAX_SFN;
-   }
-
-       slot = ((slot + rarDelay) % SCH_NUM_SLOTS);
-
-   SchDlAlloc *dlAlloc = cell->dlAlloc[slot]; /* RAR will sent in the next slot */
+   SchDlAlloc *dlAlloc =
+          cell->dlAlloc[(rachInd->timingInfo.slot+SCHED_DELTA+RAR_DELAY)%SCH_NUM_SLOTS]; /* RAR will sent in the next slot */
        RarInfo *rarInfo = &(dlAlloc->rarInfo);
 
    /* rar message presense in next slot ind and will be scheduled */
    dlAlloc->rarPres = true;
 
    /* calculate the ra-rnti value */
        RarInfo *rarInfo = &(dlAlloc->rarInfo);
 
    /* rar message presense in next slot ind and will be scheduled */
    dlAlloc->rarPres = true;
 
    /* calculate the ra-rnti value */
-       uint16_t raRnti = 0;
        raRnti = calculateRaRnti(rachInd->symbolIdx,rachInd->slotIdx,rachInd->freqIdx);
    
        /* create raCb at SCH */
        raRnti = calculateRaRnti(rachInd->symbolIdx,rachInd->slotIdx,rachInd->freqIdx);
    
        /* create raCb at SCH */
@@ -132,46 +149,61 @@ int schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    return ROK;
 }
 
    return ROK;
 }
 
-int  schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA)
+/**
+ * @brief fill RAR info function. 
+ *
+ * @details
+ *
+ *     Function : calculateRaRnti
+ *     
+ *     This function fills pdcch and pdsch info for RAR
+ *     
+ *  @param[in]  rar Allocation info
+ *  @param[in]  ra-rnti
+ *  @param[in]  PCI
+ *  @param[in]  offset to pointA to determine freq alloc
+ *  @return  ROK
+ **/
+uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA)
 {
 {
+   Inst inst = 0;
    uint8_t coreset0Idx = 0;
    uint8_t coreset0Idx = 0;
-   uint8_t searchSpace0Idx = 0;
-   //uint8_t ssbMuxPattern = 0;
    uint8_t numRbs = 0;
    uint8_t numRbs = 0;
+       uint8_t firstSymbol = 0;
    uint8_t numSymbols = 0;
    uint8_t offset = 0;
    uint8_t numSymbols = 0;
    uint8_t offset = 0;
-   //uint8_t oValue = 0;
-   //uint8_t numSearchSpacePerSlot = 0;
-   //uint8_t mValue = 0;
-   uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t FreqDomainResource[6] = {0};
    uint8_t FreqDomainResource[6] = {0};
+   SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialBwp;
 
        PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
        PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
 
 
        PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
        PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
 
-   coreset0Idx     = 0;
-   searchSpace0Idx = 0;
+   coreset0Idx     = initialBwp->pdcchCommon.raSearchSpace.coresetId;
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
-   //ssbMuxPattern = coresetIdxTable[coreset0Idx][0];
    numRbs        = coresetIdxTable[coreset0Idx][1];
    numSymbols    = coresetIdxTable[coreset0Idx][2];
    offset        = coresetIdxTable[coreset0Idx][3];
 
    numRbs        = coresetIdxTable[coreset0Idx][1];
    numSymbols    = coresetIdxTable[coreset0Idx][2];
    offset        = coresetIdxTable[coreset0Idx][3];
 
-   /* derive the search space params from table 13-11 spec 38.213 */
-   //oValue                = searchSpaceIdxTable[searchSpace0Idx][0];
-   //numSearchSpacePerSlot = searchSpaceIdxTable[searchSpace0Idx][1];
-   //mValue                = searchSpaceIdxTable[searchSpace0Idx][2];
-   firstSymbol           = searchSpaceIdxTable[searchSpace0Idx][3];
+   /* calculate time domain parameters */
+       // note: since slot value is made sl1, RAR can be sent at all slots
+       uint16_t mask = 0x2000;
+       for(firstSymbol=0; firstSymbol<14;firstSymbol++)
+       {
+          if(initialBwp->pdcchCommon.raSearchSpace.monitoringSymbol & mask)
+                  break;
+               else
+                  mask = mask>>1;
+   }
 
    /* calculate the PRBs */
    freqDomResourceAlloc( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill the PDCCH PDU */
 
    /* calculate the PRBs */
    freqDomResourceAlloc( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* 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->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);
@@ -185,7 +217,7 @@ int  schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offse
    pdcch->dci.rnti = raRnti; /* RA-RNTI */
    pdcch->dci.scramblingId = pci;
    pdcch->dci.scramblingRnti = 0;
    pdcch->dci.rnti = raRnti; /* RA-RNTI */
    pdcch->dci.scramblingId = pci;
    pdcch->dci.scramblingRnti = 0;
-   pdcch->dci.cceIndex = 0;
+   pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
    pdcch->dci.aggregLevel = 4;
    pdcch->dci.beamPdcchInfo.numPrgs = 1;
    pdcch->dci.beamPdcchInfo.prgSize = 1;
    pdcch->dci.aggregLevel = 4;
    pdcch->dci.beamPdcchInfo.numPrgs = 1;
    pdcch->dci.beamPdcchInfo.prgSize = 1;
@@ -201,17 +233,18 @@ int  schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offse
    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 = MAX_NUM_RB; /* whole of BW */
-   pdsch->pdschBwpCfg.BWPStart = 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; /* msc configured to 4 */
+      pdsch->codeword[cwCount].mcsIndex = 4; /* mcs configured to 4 */
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
-      pdsch->codeword[cwCount].tbSize = 768;
+      pdsch->codeword[cwCount].tbSize = 80/8; /* 38.214: Table 5.1.3.2-1,
+                  devided by 8 to get the value in bytes */
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
    }
    pdsch->dataScramblingId = pci;
    pdsch->numLayers = 1;
index 6bd2e1d..b8a5056 100644 (file)
@@ -30,6 +30,9 @@
 #define SIB1_REPETITION_PERIOD   20
 #define CORESET_0_INDEX      0
 #define SEARCHSPACE_0_INDEX   0
 #define SIB1_REPETITION_PERIOD   20
 #define CORESET_0_INDEX      0
 #define SEARCHSPACE_0_INDEX   0
+#define SEARCHSPACE_1_INDEX   1
+#define SS_MONITORING_SLOT_SL1   0 /* all slots */
+#define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
 #define SIB1_MCS  4
 
 /* Macros for coupling */
 #define SIB1_MCS  4
 
 /* Macros for coupling */
@@ -184,6 +187,44 @@ typedef struct sib1CellCfg
    uint16_t sib1Mcs;
 } Sib1CellCfg; 
 
    uint16_t sib1Mcs;
 } Sib1CellCfg; 
 
+typedef struct bwpParams
+{
+   uint16_t firstPrb;
+   uint16_t numPrb;
+       uint8_t  scs;
+       uint8_t  cyclicPrefix;
+}BwpParams;
+
+typedef struct candidatesInfo
+{
+   uint8_t aggLevel1;
+   uint8_t aggLevel2;
+   uint8_t aggLevel4;
+   uint8_t aggLevel8;
+   uint8_t aggLevel16;
+}CandidatesInfo;
+
+typedef struct searchSpaceCfg
+{
+   uint8_t searchSpaceId;
+       uint8_t coresetId;
+       uint16_t monitoringSlot;
+       uint16_t duration;
+       uint16_t monitoringSymbol;
+       CandidatesInfo candidate;
+}SearchSpaceCfg;
+
+typedef struct pdcchConfigCommon
+{
+   SearchSpaceCfg raSearchSpace;
+}PdcchConfigCommon;
+
+typedef struct bwpDlConfig
+{
+   BwpParams      bwp;
+       PdcchConfigCommon pdcchCommon;
+}BwpDlConfig;
+
 typedef struct macCellCfg
 {
    U16            transId;
 typedef struct macCellCfg
 {
    U16            transId;
@@ -200,6 +241,7 @@ typedef struct macCellCfg
    TDDCfg         tddCfg;     /* TDD periodicity and slot configuration */
    RSSIMeasUnit   rssiUnit;   /* RSSI measurement unit */
    Sib1CellCfg    sib1Cfg;
    TDDCfg         tddCfg;     /* TDD periodicity and slot configuration */
    RSSIMeasUnit   rssiUnit;   /* RSSI measurement unit */
    Sib1CellCfg    sib1Cfg;
+       BwpDlConfig    initialBwp;
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
index ee9552b..b08f2f8 100644 (file)
@@ -232,6 +232,44 @@ typedef struct schRachCfg
    uint8_t      raRspWindow;         /* RA Response Window */
 }SchRachCfg;
 
    uint8_t      raRspWindow;         /* RA Response Window */
 }SchRachCfg;
 
+typedef struct schBwpParams
+{
+   uint16_t firstPrb;
+   uint16_t numPrb;
+       uint8_t  scs;
+       uint8_t  cyclicPrefix;
+}SchBwpParams;
+
+typedef struct schCandidatesInfo
+{
+   uint8_t aggLevel1;
+   uint8_t aggLevel2;
+   uint8_t aggLevel4;
+   uint8_t aggLevel8;
+   uint8_t aggLevel16;
+}SchCandidatesInfo;
+
+typedef struct schSearchSpaceCfg
+{
+   uint8_t searchSpaceId;
+       uint8_t coresetId;
+       uint16_t monitoringSlot;
+       uint16_t duration;
+       uint16_t monitoringSymbol;
+       SchCandidatesInfo candidate;
+}SchSearchSpaceCfg;
+
+typedef struct schPdcchCfgCmn
+{
+   SchSearchSpaceCfg raSearchSpace;
+}SchPdcchCfgCmn;
+
+typedef struct schBwpDlCfg
+{
+   SchBwpParams   bwp;
+       SchPdcchCfgCmn pdcchCommon;
+}SchBwpDlCfg;
+
 typedef struct schCellCfg
 {
    uint16_t    cellId;     /* Cell Id */
 typedef struct schCellCfg
 {
    uint16_t    cellId;     /* Cell Id */
@@ -241,6 +279,7 @@ typedef struct schCellCfg
        SchSsbCfg   ssbSchCfg;  /* SSB config */
        SchSib1Cfg  sib1SchCfg; /* SIB1 config */
    SchRachCfg  schRachCfg; /* PRACH config */
        SchSsbCfg   ssbSchCfg;  /* SSB config */
        SchSib1Cfg  sib1SchCfg; /* SIB1 config */
    SchRachCfg  schRachCfg; /* PRACH config */
+       SchBwpDlCfg    schInitialBwp;
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
index 7dc8d0d..ecc0cb4 100644 (file)
@@ -228,6 +228,30 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
    duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = SIB1_MCS;
 
    duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
    duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = SIB1_MCS;
 
+
+   /* fill Intial DL BWP */
+   duCfgParam.macCellCfg.initialBwp.bwp.firstPrb = 0;
+   duCfgParam.macCellCfg.initialBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
+   duCfgParam.macCellCfg.initialBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
+   duCfgParam.macCellCfg.initialBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.coresetId = CORESET_0_INDEX;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.monitoringSlot =
+          SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.duration = 0;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.monitoringSymbol =
+          SS_MONITORING_SYMBOL;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.
+          candidate.aggLevel1  = 8;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.
+          candidate.aggLevel2  = 4;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.
+          candidate.aggLevel4  = 2;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.
+          candidate.aggLevel8  = 1;
+   duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.
+          candidate.aggLevel16 = 0;
+
    /* This should be calculated based on
       (number of mandatory parameters) + (number of otional parameters being filled) */
    duCfgParam.macCellCfg.numTlv = 39;
    /* This should be calculated based on
       (number of mandatory parameters) + (number of otional parameters being filled) */
    duCfgParam.macCellCfg.numTlv = 39;
index 77af097..4ad7437 100644 (file)
@@ -60,7 +60,9 @@
 #define FREQ_SHIFT_7P5KHZ FALSE
 #define SSB_PBCH_PWR -5
 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
 #define FREQ_SHIFT_7P5KHZ FALSE
 #define SSB_PBCH_PWR -5
 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
+#define TOTAL_PRB_BW 106
 #define SUBCARRIER_SPACING 0
 #define SUBCARRIER_SPACING 0
+#define NORMAL_CYCLIC_PREFIX 0
 #define SCS_CARRIER_BANDWIDTH 273         /* Subcarrier spacing- carrier bandwidth */
 #define OFFSET_TO_POINT_A 24                     /* PRB Offset to Point A */
 #define BETA_PSS BETA_PSS_0DB  
 #define SCS_CARRIER_BANDWIDTH 273         /* Subcarrier spacing- carrier bandwidth */
 #define OFFSET_TO_POINT_A 24                     /* PRB Offset to Point A */
 #define BETA_PSS BETA_PSS_0DB  
index a0f040e..191c87d 100644 (file)
@@ -1655,7 +1655,7 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
          (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \
          ACTIVATION_IN_PROGRESS))
       {
          (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \
          ACTIVATION_IN_PROGRESS))
       {
-         DU_LOG("\nDU APP : Cell Id %d is ACTIVE", slotInfo->cellId);
+         DU_LOG("\nDU APP : 5G-NR Cell %d is UP", slotInfo->cellId);
          duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED;
       }
       
          duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED;
       }
       
index b336c14..e6f4033 100644 (file)
@@ -384,8 +384,13 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
    }
    else
    {
    }
    else
    {
+      slotIndMsg->sfn = sfnValue;
+      slotIndMsg->slot = slotValue;
+      DU_LOG("\n\nPHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue);
+
+               /* increment for the next TTI */
       slotValue++;
       slotValue++;
-      if(sfnValue > MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE)
+      if(sfnValue >= MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE)
       {
          sfnValue = 0;
          slotValue = 0;
       {
          sfnValue = 0;
          slotValue = 0;
@@ -395,10 +400,7 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
          sfnValue++;
          slotValue = 0;
       }
          sfnValue++;
          slotValue = 0;
       }
-      slotIndMsg->sfn = sfnValue;
-      slotIndMsg->slot = slotValue;
       fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, sizeof(fapi_slot_ind_t));
       fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, sizeof(fapi_slot_ind_t));
-      DU_LOG("\n\nPHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue);
       handlePhyMessages(slotIndMsg->header.message_type_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
       MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t));
    }
       handlePhyMessages(slotIndMsg->header.message_type_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
       MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t));
    }
@@ -534,7 +536,7 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
 PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
 {
 #ifdef FAPI
 PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
 {
 #ifdef FAPI
-   uint8_t pduCount;
+   //uint8_t pduCount;
 
    DU_LOG("\nPHY STUB: Received TX DATA Request");
 
 
    DU_LOG("\nPHY STUB: Received TX DATA Request");
 
@@ -597,7 +599,7 @@ PUBLIC S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg)
    MAC_FREE(ulTtiReq->pdus, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
        MAC_FREE(ulTtiReq, sizeof(fapi_ul_tti_req_t));
 
    MAC_FREE(ulTtiReq->pdus, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
        MAC_FREE(ulTtiReq, sizeof(fapi_ul_tti_req_t));
 
-   if(rachIndSent == false && ulTtiReq->slot == 8)
+   if(rachIndSent == false && ulTtiReq->sfn == 2 && ulTtiReq->slot == 6)
    {
       rachIndSent = true;
       l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
    {
       rachIndSent = true;
       l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);