Nanosleep for slot Ind, warning fixes, WLS changes, memory leak fixes 84/3484/7
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Mon, 27 Apr 2020 14:02:08 +0000 (19:32 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Mon, 4 May 2020 09:18:56 +0000 (14:48 +0530)
Change-Id: Ic7cc64bc897bda5bf772578cf2a9efc6fa9b702c
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
14 files changed:
src/5gnrmac/lwr_mac.h
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/rg_ex_ms.c
src/5gnrmac/rg_lmm.c
src/5gnrrlc/kw_lim.c
src/5gnrrlc/kw_ptli.c
src/5gnrrlc/mac_stub.c
src/cm/rgu.c
src/cm/rgu.x
src/du_app/du_mgr.h
src/du_app/du_msg_hdl.c
src/phy_stub/l1_bdy1.c
src/phy_stub/l1_bdy2.c

index 017ece5..b8cc0af 100644 (file)
 #include "cm_lib.x"
 #include "du_app_mac_inf.h"
 
+#ifdef INTEL_WLS
+#define LWR_MAC_ALLOC(_datPtr, _size)   WLS_MEM_ALLOC(_datPtr, _size);
+#else                                     
+#define LWR_MAC_ALLOC(_datPtr, _size)   MAC_ALLOC(_datPtr, _size);
+#endif                                    
+
 typedef enum
 {
    PHY_STATE_IDLE,
index c0ba316..091b492 100644 (file)
@@ -1322,18 +1322,12 @@ S16 lwr_mac_handleParamReqEvt(void *msg)
    uint32_t msgLen;      //Length of message Body
    msgLen = 0;
    fapi_param_req_t *paramReq;
-#ifdef INTEL_WLS
-   WLS_MEM_ALLOC(paramReq, sizeof(fapi_param_req_t));
-#else
-   MAC_ALLOC(paramReq, sizeof(fapi_param_req_t));
-#endif
+       LWR_MAC_ALLOC(paramReq, sizeof(fapi_param_req_t));
    if(paramReq != NULLP)
    {
       fillMsgHeader(&paramReq->header, FAPI_PARAM_REQUEST, msgLen);
       DU_LOG("\nLOWER MAC: Sending Param Request to Phy");
       LwrMacSendToPhy(paramReq->header.message_type_id, sizeof(fapi_param_req_t), (void *)paramReq);
-      MAC_FREE(paramReq, sizeof(fapi_param_req_t));
       return ROK;
    }
    else
@@ -1857,8 +1851,6 @@ S16 lwr_mac_handleParamRspEvt(void *msg)
               }
            }
            MAC_FREE(cellParam, sizeof(ClCellParam));
-           MAC_FREE(paramRsp, sizeof(fapi_param_resp_t));
-             
            sendToLowerMac(FAPI_CONFIG_REQUEST, 0, (void *)NULL);
            return ROK;
          }
@@ -1917,12 +1909,7 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
    cellParams = rgCb[inst].cell;
    macCfgParams = cellParams->macCellCfg;
    configReqSize = sizeof(fapi_config_req_t) + (macCfgParams.numTlv * sizeof(fapi_uint16_tlv_t));
-#ifdef INTEL_WLS
-   WLS_MEM_ALLOC(configReq, configReqSize);
-#else
-   MAC_ALLOC(configReq, configReqSize);
-#endif
-
+       LWR_MAC_ALLOC(configReq, configReqSize);
    if(configReq != NULL)
    {
       configReq->number_of_tlvs = macCfgParams.numTlv;
@@ -1965,11 +1952,18 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
       fillTlvs(&configReq->tlvs[index++], FAPI_K1_TAG,                         sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ZERO_CORR_CONF_TAG ,      sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG,  sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen);
-      //MAC_ALLOC(macCfgParams.prachCfg.fdm[0].unsuedRootSeq, \
-         sizeof(uint8_t)*macCfgParams.prachCfg.fdm[0].numUnusedRootSeq);
-      macCfgParams.prachCfg.fdm[0].unsuedRootSeq = (uint8_t *)malloc(sizeof(uint8_t)*macCfgParams.prachCfg.fdm[0].numUnusedRootSeq);
-      fillTlvs(&configReq->tlvs[index++], FAPI_UNUSED_ROOT_SEQUENCES_TAG,
-                  sizeof(uint8_t), *(macCfgParams.prachCfg.fdm[0].unsuedRootSeq), &msgLen);
+               if(macCfgParams.prachCfg.fdm[0].numUnusedRootSeq)
+               {
+                  LWR_MAC_ALLOC(macCfgParams.prachCfg.fdm[0].unsuedRootSeq ,
+                     sizeof(uint8_t)*macCfgParams.prachCfg.fdm[0].numUnusedRootSeq);
+                  fillTlvs(&configReq->tlvs[index++], FAPI_UNUSED_ROOT_SEQUENCES_TAG,\
+                     sizeof(uint8_t), *(macCfgParams.prachCfg.fdm[0].unsuedRootSeq), &msgLen);
+               }
+               else
+               {
+                  macCfgParams.prachCfg.fdm[0].unsuedRootSeq = NULL;
+               }
+
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PER_RACH_TAG,               sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG,  sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen);
 
@@ -1995,7 +1989,6 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
       DU_LOG("\nLOWER_MAC: Sending Config Request to Phy");
       /* TODO : Recheck the size / msglen to be sent to WLS_Put*/
       LwrMacSendToPhy(configReq->header.message_type_id, msgLen, (void *)configReq);
-      MAC_FREE(configReq, configReqSize);
       return ROK;
    }
    else
@@ -2019,14 +2012,13 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
    {
       if(configRsp->error_code == MSG_OK)
       {
-         DU_LOG("\nLOWER MAC: PHY has moved to Conigured state \n");
+         DU_LOG("\nLOWER 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
           * Support LC and LWLC for sending config rsp to MAC 
           */
          fapiMacConfigRsp();
-         MAC_FREE(configRsp, sizeof(fapi_config_resp_t));
          return ROK;
       }
       else
@@ -2051,18 +2043,13 @@ S16 lwr_mac_handleStartReqEvt(void *msg)
 #ifdef FAPI
    uint32_t msgLen = 0;
    fapi_start_req_t *startReq;
-#ifdef INTEL_WLS
-   WLS_MEM_ALLOC(startReq, sizeof(fapi_start_req_t));
-#else
-   MAC_ALLOC(startReq, sizeof(fapi_start_req_t));
-#endif
 
+       LWR_MAC_ALLOC(startReq, sizeof(fapi_start_req_t));
    if(startReq != NULL)
    {
       fillMsgHeader(&startReq->header, FAPI_START_REQUEST, msgLen);
       DU_LOG("\nLOWER MAC: Sending Start Request to PHY");
       LwrMacSendToPhy(startReq->header.message_type_id, sizeof(fapi_start_req_t), (void *)startReq);
-      MAC_FREE(startReq, sizeof(fapi_start_req_t));
       return ROK;
    }
    else
@@ -2471,11 +2458,7 @@ uint32_t *msgLen)
        dlTtiReqPdu->u.pdcch_pdu.shiftIndex =  pdcchInfo->coreset0Cfg.shiftIndex;
        dlTtiReqPdu->u.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity;
        dlTtiReqPdu->u.pdcch_pdu.numDlDci = pdcchInfo->numDlDci;
-#ifdef INTEL_WLS       
-       WLS_MEM_ALLOC(dlTtiReqPdu->u.pdcch_pdu.dlDci, sizeof(fapi_dl_dci_t));
-#else
-       MAC_ALLOC(dlTtiReqPdu->u.pdcch_pdu.dlDci, sizeof(fapi_dl_dci_t));
-#endif
+                LWR_MAC_ALLOC(dlTtiReqPdu->u.pdcch_pdu.dlDci, sizeof(fapi_dl_dci_t));
        if(pdcchInfo->dci.rnti == SI_RNTI)
                 {
           fillSib1DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo);
@@ -2641,7 +2624,7 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
        /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
        pduDesc->tlvs[0].tl.tag = 1; /* pointer to be sent */
        pduDesc->tlvs[0].tl.length = macCellCfg->sib1Cfg.sib1PduLen;
-   MAC_ALLOC(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen);
+       LWR_MAC_ALLOC(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen);
        if(sib1TxdataValue == NULLP)
        {
           return RFAILED;
@@ -2656,9 +2639,10 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
    pduDesc->pduLength = pduLen; 
        msgLen += pduLen;
 
-       /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
-        * But since we did not implement WLS, this has to be done here */
-        MAC_FREE(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen);
+#ifndef INTEL_WLS   
+   MAC_FREE(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen);
+#endif
+
 
        return ROK;
 }
@@ -2687,30 +2671,33 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
    uint32_t pduLen = 0;
        uint32_t *rarTxdataValue = NULLP;
 
-       pduDesc->pduIndex = pduIndex;
-       pduDesc->numTlvs = 1;
+       pduDesc[pduIndex].pduIndex = pduIndex;
+       pduDesc[pduIndex].numTlvs = 1;
 
        /* fill the TLV */
        /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
-       pduDesc->tlvs[0].tl.tag = 1; /* pointer to be sent */
-       pduDesc->tlvs[0].tl.length = rarInfo->rarPduLen;
-   MAC_ALLOC(rarTxdataValue,rarInfo->rarPduLen);
+       pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */
+       pduDesc[pduIndex].tlvs[0].tl.length = rarInfo->rarPduLen;
+       LWR_MAC_ALLOC(rarTxdataValue,rarInfo->rarPduLen);
        if(rarTxdataValue == NULLP)
        {
           return RFAILED;
        }
        memcpy(rarTxdataValue,rarInfo->rarPdu,rarInfo->rarPduLen);
-       pduDesc->tlvs[0].value = (uint32_t)rarTxdataValue;
+       pduDesc[pduIndex].tlvs[0].value = (uint32_t)rarTxdataValue;
 
    /* The total length of the PDU description and      PDU data */
        pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */
        pduLen += sizeof(fapi_uint32_tlv_t); /* only 1 TLV is present */
-   pduDesc->pduLength = pduLen; 
+   pduDesc[pduIndex].pduLength = pduLen; 
        msgLen += pduLen;
 
-       /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
-        * But since we did not implement WLS, this has to be done here */
-        MAC_FREE(rarTxdataValue,rarInfo->rarPduLen);
+/* TODO: The pointer value which was stored, needs to be free-ed at PHY *
+ * But since we did not implement WLS, this has to be done here
+ */
+#ifndef INTEL_WLS   
+   MAC_FREE(rarTxdataValue,rarInfo->rarPduLen);
+#endif
 
        return ROK;
 }
@@ -2755,11 +2742,7 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
 
                if(dlTtiReqtimingInfo != NULLP)
                {
-#ifdef INTEL_WLS
-                       WLS_MEM_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
-#else
-                       MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
-#endif
+                  LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
                        if(dlTtiReq != NULLP)
                        {
                                dlTtiReq->sfn = dlTtiReqtimingInfo->sfn;
@@ -2770,11 +2753,13 @@ uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo)
                                dlTtiReq->nGroup = 0;
                                if(dlTtiReq->nPdus > 0)
                                {
-#ifdef INTEL_WLS
-                                       WLS_MEM_ALLOC(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
-#else
-                                       MAC_ALLOC(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
-#endif
+                                  LWR_MAC_ALLOC(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
+               if(!dlTtiReq->pdus)
+               {
+                  DU_LOG("\nLOWER MAC: Memory allocation failed");
+                  return RFAILED;
+               }
+          
                                        if(currDlSlot->dlInfo.isBroadcastPres)
                                        {
                                                if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
@@ -2821,72 +2806,43 @@ 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);
 
-                                       /* FREE the allocated memories */
-                                       if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-                                       {
-                                               if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
-                                               {
-                                                       MAC_FREE(dlTtiReq->pdus[1].u.pdcch_pdu.dlDci, 
-                                                                       sizeof(fapi_dl_dci_t));
-                                               }
-                                               else
-                                               {
-                                                       MAC_FREE(dlTtiReq->pdus[0].u.pdcch_pdu.dlDci, 
-                                                                       sizeof(fapi_dl_dci_t));
-                                               }
-                                       }
-                                       if(currDlSlot->dlInfo.isRarPres)
-                                       {
-                                               if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
-                                               {
-                                                       MAC_FREE(dlTtiReq->pdus[1].u.pdcch_pdu.dlDci, 
-                                                                       sizeof(fapi_dl_dci_t));
-                                               }
-                                               else
-                                               {
-                                                       MAC_FREE(dlTtiReq->pdus[0].u.pdcch_pdu.dlDci, 
-                                                                       sizeof(fapi_dl_dci_t));
-                                               }
-                                       }
-
-                                       MAC_FREE(dlTtiReq->pdus, (nPdu * sizeof(fapi_dl_tti_req_pdu_t)));
-
                /* send TX_Data request message */
                if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
                {
                   msgLen = 0;
-                  MAC_ALLOC(txDataReq,sizeof(fapi_tx_data_req_t));
+                  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,
+                        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);
-                                               MAC_FREE(txDataReq,sizeof(fapi_tx_data_req_t));
                }
                if(currDlSlot->dlInfo.isRarPres)
                {
                   msgLen = 0;
                                                /* mux and form RAR pdu */
                                                fillRarPdu(&currDlSlot->dlInfo.rarAlloc.rarInfo);
-
-                  MAC_ALLOC(txDataReq,sizeof(fapi_tx_data_req_t));
+                  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,
+                        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);
-                                               MAC_FREE(txDataReq,sizeof(fapi_tx_data_req_t));
                }
                                }
                                else
@@ -2896,7 +2852,6 @@ 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);
                                }
-                               MAC_FREE(dlTtiReq, sizeof(fapi_dl_tti_req_t));
                                return ROK;
                        }
                        else
@@ -3069,11 +3024,7 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
 
       if(currTimingInfo != NULLP)
       {
-#ifdef INTEL_WLS
-         WLS_MEM_ALLOC(ulTtiReq, sizeof(fapi_ul_tti_req_t));
-#else
-         MAC_ALLOC(ulTtiReq, sizeof(fapi_ul_tti_req_t));
-#endif
+         LWR_MAC_ALLOC(ulTtiReq, sizeof(fapi_ul_tti_req_t));
          if(ulTtiReq != NULLP)
          {
             ulTtiReq->sfn = currTimingInfo->sfn;
@@ -3083,11 +3034,8 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
             ulTtiReq->nGroup = 0;
             if(ulTtiReq->nPdus > 0)
             {
-#ifdef INTEL_WLS
-               WLS_MEM_ALLOC(ulTtiReqPdu, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
-#else
-               MAC_ALLOC(ulTtiReqPdu, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
-#endif
+                                  LWR_MAC_ALLOC(ulTtiReqPdu, (ulTtiReq->nPdus *
+                                       sizeof(fapi_ul_tti_req_pdu_t)));
                /* Fill Prach Pdu */
                if(ulTtiReq->rachPresent)
                {
@@ -3100,7 +3048,6 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
                  fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
                  DU_LOG("\nLOWER MAC: Sending UL TTI Request");
                  LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
-                                         MAC_FREE(ulTtiReqPdu, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
                }
             } 
             else
@@ -3110,7 +3057,6 @@ S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo)
                 DU_LOG("\nLOWER MAC: Sending UL TTI Request");
                 LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
             }
-                               MAC_FREE(ulTtiReq, sizeof(fapi_ul_tti_req_t));
                                return ROK;
          }
              else
index 90230a3..92eb13a 100644 (file)
 
 extern void sendToLowerMac(uint16_t msgType, uint32_t msgLen, void *msg);
 
+/*******************************************************************
+ *
+ * @brief Processes DL data from RLC
+ *
+ * @details
+ *
+ *    Function : MacRlcProcDlData 
+ *
+ *    Functionality:
+ *      Processes DL data from RLC
+ *
+ * @params[in] Post structure
+ *             DL data
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t MacRlcProcDlData(Pst* pst, SpId spId, RlcMacData *dlData)
+{
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Processes BO status from RLC
+ *
+ * @details
+ *
+ *    Function : MacRlcProcBOStatus
+ *
+ *    Functionality:
+ *      Processes BO status from RLC
+ *
+ * @params[in] Post structure
+ *             BO status
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t MacRlcProcBOStatus(Pst* pst, SpId spId, RlcMacBOStatus*      boStatus)
+{
+   return ROK;
+}
+
+
 /*******************************************************************
  *
  * @brief Handles cell start reuqest from DU APP
index 6ee230e..e6a65c4 100755 (executable)
@@ -233,10 +233,10 @@ Buffer  *mBuf;                      /* message buffer       */
          cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
          break;
       case EVTRLCDLDAT:
-         unpackDlData(RgUiRguDDatReq, pst, mBuf);
+         unpackDlData(MacRlcProcDlData, pst, mBuf);
          break;
       case EVTRLCBOSTA:
-         unpackBOStatus(RgUiRguDStaRsp, pst, mBuf);
+         unpackBOStatus(MacRlcProcBOStatus, pst, mBuf);
          break;
 #ifdef LTE_L2_MEAS
 
index 70cc657..d5176f1 100755 (executable)
@@ -2287,7 +2287,7 @@ int MacProcSchCellCfgCfm
 {
        if(schCellCfgCfm->rsp == RSP_OK)
        {
-      sendToLowerMac(PARAM_REQUEST, 0, (void *)NULL);
+      sendToLowerMac(CONFIG_REQUEST, 0, (void *)NULL);
        }
        else
        {
index 303745a..62adb4e 100755 (executable)
@@ -473,7 +473,7 @@ RguDDatIndInfo   *datInd;
  *         RFAILED - failure
  *
  * ****************************************************************/
-PUBLIC S16 RlcMacProcSchedRep(Pst *pst, SuId suId, RlcMacSchedRep *schRep)
+PUBLIC uint16_t RlcMacProcSchedRep(Pst *pst, SuId suId, RlcMacSchedRepInfo *schRep)
 {
    U8 idx;                     /* Iterator */
    U8 nmbDLch = 0;                 /* Number of dedicated logical channles */
@@ -530,7 +530,7 @@ PUBLIC S16 RlcMacProcSchedRep(Pst *pst, SuId suId, RlcMacSchedRep *schRep)
       KwLiRguDStaInd(pst, suId, dLchSchInfo);
    }
    
-   KW_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRep));
+   KW_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRepInfo));
 
    RETVALUE(ROK);
 }
index 9f23fd3..e0402ff 100755 (executable)
@@ -149,7 +149,7 @@ PUBLIC RguBndReq kwLiRguUbndReqMt[] =
 
 /* RGU Dedicated Channel Data Request primitive */
 
-PUBLIC RguDDatReq rlcMacSendDlDataOpts[] =
+PUBLIC RlcMacDlData rlcMacSendDlDataOpts[] =
 {
 #ifdef EGTP_TEST
    macStubSendDlData,
@@ -160,7 +160,7 @@ PUBLIC RguDDatReq rlcMacSendDlDataOpts[] =
    packDlData,            /* 0 - loosely coupled */
 #endif /* LCRGUIRGU */
 #ifdef RG 
-   RgUiRguDDatReq,            /* 1 - tightly coupled, MAC  */
+   MacRlcProcDlData,      /* 1 - tightly coupled, MAC  */
 #endif /* RG */
 #ifdef LCKWLIRGU
    packDlData,            /* 0 - loosely coupled */
@@ -171,7 +171,7 @@ PUBLIC RguDDatReq rlcMacSendDlDataOpts[] =
 
 /* RLC logical Channel Status primitive */
 
-PUBLIC RguDStaRsp rlcMacSendBOStatusOpts[] =
+PUBLIC RlcMacBoStatus rlcMacSendBOStatusOpts[] =
 {
 #ifdef EGTP_TEST
    macStubBOStatus,
@@ -182,7 +182,7 @@ PUBLIC RguDStaRsp rlcMacSendBOStatusOpts[] =
    packBOStatus,            /* 0 - loosely coupled */
 #endif /* LCRGUIRGU */
 #ifdef RG 
-   RgUiRguDStaRsp,            /* 1 - tightly coupled, MAC  */
+   MacRlcProcBOStatus,            /* 1 - tightly coupled, MAC  */
 #endif /* RG */
 #ifdef LCKWLIRGU
    packBOStatus,            /* 0 - LWLC loosely coupled */
index df05b99..1b621bf 100644 (file)
@@ -26,7 +26,7 @@ uint64_t ulDatNum = 0;
 PUBLIC S16 macStubBOStatus(Pst *pst, SpId spId, RlcMacBOStatus *boSta)
 {
   Pst rspPst;
-  RlcMacSchedRep *schRep;
+  RlcMacSchedRepInfo *schRep;
 
   DU_LOG("\nMAC : Received BO status from RLC");
 
@@ -42,7 +42,7 @@ PUBLIC S16 macStubBOStatus(Pst *pst, SpId spId, RlcMacBOStatus *boSta)
   rspPst.pool    = pst->pool;
 
   /* Filling Scheduling Report */
-  KW_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRep));
+  KW_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRepInfo));
    
   schRep->cellId = boSta->cellId;
   schRep->rnti   = boSta->rnti;
index 075f897..809f60e 100755 (executable)
@@ -428,19 +428,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 packDlData
+PUBLIC uint16_t packDlData
 (
 Pst* pst,
 SpId spId,
 RlcMacData  *dlData
 )
-#else
-PUBLIC S16 packDlData(pst, spId, dlData)
-Pst* pst;
-SpId spId;
-RlcMacData  dlData;
-#endif
 {
    Buffer *mBuf = NULLP;
    TRC3(packDlData)
@@ -524,22 +517,14 @@ RlcMacData  dlData;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 unpackDlData
 (
-RguDDatReq func,
+RlcMacDlData func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackDlData(func, pst, mBuf)
-RguDDatReq func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SpId spId;
-//   RguDDatReqInfo *datReq;
    RlcMacData *dlData;
    
    TRC3(unpackDlData)
@@ -693,19 +678,12 @@ RlcMacData  *ulData;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 unpackRcvdUlData
 (
-RguDDatInd            func,
+RlcMacUlData func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackRcvdUlData(func, pst, mBuf)
-RguDDatInd      func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SuId suId;
    RlcMacData *ulData;
@@ -1029,19 +1007,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 packBOStatus
+PUBLIC uint16_t packBOStatus
 (
 Pst* pst,
 SpId spId,
 RlcMacBOStatus  *boStatus
 )
-#else
-PUBLIC S16 packBOStatus(pst, spId, staRsp)
-Pst* pst;
-SpId spId;
-RlcMacBOStatus  *boStatus;
-#endif
 {
    RlcMacBOStatus  *boStaInfo = NULL;
    Buffer *mBuf = NULLP;
@@ -1123,19 +1094,12 @@ RlcMacBOStatus  *boStatus;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 unpackBOStatus
+PUBLIC uint16_t unpackBOStatus
 (
-RguDStaRsp func,
+RlcMacBoStatus func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackBOStatus(func, pst, mBuf)
-RguDStaRsp func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SpId spId;
    RlcMacBOStatus *boSta;
@@ -1419,19 +1383,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 packSchedRep
 (
 Pst* pst,
 SuId suId,
-RlcMacSchedRep  * schRep
+RlcMacSchedRepInfo  * schRep
 )
-#else
-PUBLIC S16 packSchedRep(pst, suId, staInd)
-Pst* pst;
-SuId suId;
-RlcMacSchedRep  * schRep;
-#endif
 {
    Buffer *mBuf = NULLP;
    TRC3(packSchedRep)
@@ -1442,7 +1399,7 @@ RlcMacSchedRep  * schRep;
           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
 #endif      
-      SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+      SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
       RETVALUE(RFAILED);
    }
    if (pst->selector == RGU_SEL_LWLC)
@@ -1458,12 +1415,12 @@ RlcMacSchedRep  * schRep;
                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
 #endif      
         SPutSBuf(pst->region, pst->pool, (Data *)schRep, 
-                                         sizeof(RlcMacSchedRep));
+                                         sizeof(RlcMacSchedRepInfo));
          SPutMsg(mBuf);
          RETVALUE(RFAILED);
       } 
       if (SPutSBuf(pst->region, pst->pool, (Data *)schRep,
-                                  sizeof(RlcMacSchedRep)) != ROK) {
+                                  sizeof(RlcMacSchedRepInfo)) != ROK) {
 #if (ERRCLASS & ERRCLS_ADD_RES)      
          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
@@ -1482,7 +1439,7 @@ RlcMacSchedRep  * schRep;
 #endif      
       if (schRep != NULLP)
       {
-         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
       }
       SPutMsg(mBuf);
       RETVALUE(RFAILED);
@@ -1509,23 +1466,15 @@ RlcMacSchedRep  * schRep;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 unpackSchedRep
 (
-RguDStaInd func,
+RlcMacSchedRep func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackSchedRep(func, pst, mBuf)
-RguDStaInd func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SuId suId;
-//   RguDStaIndInfo *staInd;
-   RlcMacSchedRep *schRep;
+   RlcMacSchedRepInfo *schRep;
    
    TRC3(unpackSchedRep)
 
@@ -1544,7 +1493,7 @@ Buffer *mBuf;
    }
    else 
    {
-      if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRep))) != ROK) {
+      if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRepInfo))) != ROK) {
 #if (ERRCLASS & ERRCLS_ADD_RES)      
          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
@@ -1560,7 +1509,7 @@ Buffer *mBuf;
              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
 #endif      
          SPutMsg(mBuf);
-         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
          RETVALUE(RFAILED);
       }
    }
@@ -3143,17 +3092,11 @@ Buffer *mBuf;
 *     File  : 
 *
 **********************************************************/
-#ifdef ANSI
 PUBLIC S16 packSchedRepInfo
 (
-RlcMacSchedRep *param,
+RlcMacSchedRepInfo *param,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 packSchedRepInfo(param, mBuf)
-RlcMacSchedRep *param;
-Buffer *mBuf;
-#endif
 {
    S32 idx;
 
@@ -3190,17 +3133,11 @@ Buffer *mBuf;
 *     File  : 
 *
 **********************************************************/
-#ifdef ANSI
 PUBLIC S16 unpackSchedRepInfo
 (
-RlcMacSchedRep *param,
+RlcMacSchedRepInfo *param,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackSchedRepInfo(param, mBuf)
-RlcMacSchedRep *param;
-Buffer *mBuf;
-#endif
 {
    S32 idx;
 
index 88c80f4..0338cee 100755 (executable)
@@ -421,7 +421,7 @@ typedef struct rlcMacSchedRep
    CmLteRnti    rnti;         /*!< Temporary CRNTI */
    U8           nmbLch;       /*!< Number of logical channels scheduled */
    RlcMacLchSta lchSta[RGU_MAX_LC];  /*!< Scheduled info of logical channels */
-}RlcMacSchedRep;
+}RlcMacSchedRepInfo;
 
 /* UL Data i.e. RLC PDU info from RLC to MAC */
 typedef struct rlcMacPduInfo
@@ -472,7 +472,12 @@ typedef S16 (*RguCDatReq) ARGS((
 typedef S16 (*RguDDatReq) ARGS((
    Pst*                 pst,
    SpId                 spId,
-   RguDDatReqInfo  *    datReq));
+   RguDDatReqInfo       *datReq));
+
+typedef uint16_t (*RlcMacDlData) ARGS((
+   Pst*                 pst,
+   SpId                 spId,
+   RlcMacData           *dlData));
 /** @brief Data Indication from MAC to RLC to 
  * forward the data received for common channels */
 typedef S16 (*RguCDatInd) ARGS((
@@ -484,7 +489,12 @@ typedef S16 (*RguCDatInd) ARGS((
 typedef S16 (*RguDDatInd) ARGS((
    Pst*                 pst,
    SuId                 suId,
-   RlcMacData     *    datInd));
+   RguDDatIndInfo       *datInd));
+
+typedef S16 (*RlcMacUlData) ARGS((
+   Pst*                 pst,
+   SuId                 suId,
+   RlcMacData           *ulData));
 /** @brief Status Response from RLC to MAC to 
  * inform the BO report for common channels */
 typedef S16 (*RguCStaRsp) ARGS((
@@ -497,6 +507,12 @@ typedef S16 (*RguDStaRsp) ARGS((
    Pst*                 pst,
    SpId                 spId,
    RguDStaRspInfo  *    staRsp));
+
+typedef uint16_t (*RlcMacBoStatus) ARGS((
+   Pst*                 pst,
+   SpId                 spId,
+   RlcMacBOStatus       *boStatus));
+
 /** @brief Status Indication from MAC to RLC  
  * as a response to the staRsp primitive from RLC */
 typedef S16 (*RguCStaInd) ARGS((
@@ -508,7 +524,12 @@ typedef S16 (*RguCStaInd) ARGS((
 typedef S16 (*RguDStaInd) ARGS((
    Pst*                 pst,
    SuId                 suId,
-   RlcMacSchedRep  *    staInd));
+   RguDStaIndInfo *    staInd));
+
+typedef uint16_t (*RlcMacSchedRep) ARGS((
+   Pst*                 pst,
+   SuId                 suId,
+   RlcMacSchedRepInfo       *schRep));
 
 typedef S16 (*RguFlowCntrlIndInfo) ARGS((
    Pst                  *pst,
@@ -572,6 +593,9 @@ EXTERN S16 RgUiRguCDatReq ARGS((Pst* pst,SpId spId,RguCDatReqInfo *datReq));
  * @return ROK/RFAILED
 */
 EXTERN S16 RgUiRguDDatReq ARGS((Pst* pst,SpId spId,RguDDatReqInfo  *datReq));
+
+EXTERN uint16_t MacRlcProcDlData(Pst* pst, SpId spId, RlcMacData *dlData);
+
 /** @brief Data Indication from MAC to RLC to 
  * forward the data received for common channels
  * @param pst Pointer to the post structure.
@@ -604,6 +628,9 @@ EXTERN S16 RgUiRguCStaRsp ARGS((Pst* pst,SpId spId,RguCStaRspInfo  *staRsp));
  * @return ROK/RFAILED
 */
 EXTERN S16 RgUiRguDStaRsp ARGS((Pst* pst,SpId spId,RguDStaRspInfo  *staRsp));
+
+EXTERN uint16_t MacRlcProcBOStatus(Pst* pst, SpId spId, RlcMacBOStatus* boStatus);
+
 /** @brief Status Indication from MAC to RLC  
  * as a response to the staRsp primitive from RLC.
  * @param pst Pointer to the post structure.
@@ -718,10 +745,10 @@ EXTERN S16 RlcMacSendBOStatus ARGS((
 
 /**@brief Primitive invoked from MAC to RLC to
  * inform scheduling result for logical channels */
-EXTERN S16 RlcMacProcSchedRep ARGS((
+EXTERN uint16_t RlcMacProcSchedRep ARGS((
    Pst*                 pst,
    SuId                 suId,
-   RlcMacSchedRep       *schRep
+   RlcMacSchedRepInfo       *schRep
 ));
 /** @brief Status Indication from MAC to RLC  
  * as a response to the staRsp primitive from RLC.
@@ -825,7 +852,7 @@ EXTERN S16 cmUnpkRguCDatReq ARGS((
 ));
 /** @brief Request from RLC to MAC for forwarding SDUs on 
  * dedicated channel for transmission */
-EXTERN S16 packDlData ARGS((
+EXTERN uint16_t packDlData ARGS((
    Pst*                 pst,
    SpId                 spId,
    RlcMacData      *    datReq
@@ -833,7 +860,7 @@ EXTERN S16 packDlData ARGS((
 /** @brief Request from RLC to MAC for forwarding SDUs on 
  * dedicated channel for transmission */
 EXTERN S16 unpackDlData ARGS((
-   RguDDatReq           func,
+   RlcMacDlData         func,
    Pst*                 pst,
    Buffer               *mBuf
 ));
@@ -861,7 +888,7 @@ EXTERN S16 packRcvdUlData ARGS((
 /** @brief Data Indication from MAC to RLC to 
  * forward the data received for dedicated channels*/
 EXTERN S16 unpackRcvdUlData ARGS((
-   RguDDatInd          func,
+   RlcMacUlData         func,
    Pst*                 pst,
    Buffer               *mBuf
 ));
@@ -881,15 +908,15 @@ EXTERN S16 cmUnpkRguCStaRsp ARGS((
 ));
 /** @brief Primitive invoked from RLC to MAC to 
  * inform the BO report for dedicated channels*/
-EXTERN S16 packBOStatus ARGS((
+EXTERN uint16_t packBOStatus ARGS((
    Pst*                 pst,
    SpId                 spId,
    RlcMacBOStatus*      boStatus
 ));
 /** @brief Primitive invoked from RLC to MAC to 
  * inform the BO report for dedicated channels*/
-EXTERN S16 unpackBOStatus ARGS((
-   RguDStaRsp           func,
+EXTERN uint16_t unpackBOStatus ARGS((
+   RlcMacBoStatus       func,
    Pst*                 pst,
    Buffer               *mBuf
 ));
@@ -918,7 +945,7 @@ EXTERN S16 cmUnpkRguCStaInd ARGS((
 EXTERN S16 packSchedRep ARGS((
    Pst*                 pst,
    SuId                 suId,
-   RlcMacSchedRep  *    staInd
+   RlcMacSchedRepInfo   *staInd
 ));
 EXTERN S16 cmPkRguFlowCntrlInfo ARGS((
 RguFlowCntrlInd *param, 
@@ -949,7 +976,7 @@ Buffer           *mBuf
  * Informs RLC of the totalBufferSize and Timing Info 
  * for the transmission on dedicated channels. */
 EXTERN S16 unpackSchedRep ARGS((
-   RguDStaInd           func,
+   RlcMacSchedRep       func,
    Pst*                 pst,
    Buffer               *mBuf
 ));
@@ -1087,11 +1114,11 @@ EXTERN S16 cmUnpkRguLchStaInd ARGS((
    Buffer               *mBuf
 ));
 EXTERN S16 packSchedRepInfo ARGS((
-   RlcMacSchedRep       *param,
+   RlcMacSchedRepInfo   *param,
    Buffer               *mBuf
 ));
 EXTERN S16 unpackSchedRepInfo ARGS((
-   RlcMacSchedRep       *param,
+   RlcMacSchedRepInfo   *param,
    Buffer               *mBuf
 ));
   
index 35ef06a..a05e7c7 100644 (file)
@@ -60,7 +60,7 @@
 #define DU_APP_MEM_REGION    0
 #define RLC_UL_MEM_REGION     1
 #define RLC_DL_MEM_REGION     4
-#define RG_MEM_REGION     4
+#define MAC_MEM_REGION     4
 
 #define DU_POOL  1
 #define RLC_POOL  1
index bc6d94b..0e61f39 100644 (file)
@@ -686,7 +686,7 @@ S16 duBuildMacGenCfg()
    genCfg   = &(rgMngmt.t.cfg.s.genCfg);
    
    /*----------- Fill General Configuration Parameters ---------*/
-   genCfg->mem.region = RG_MEM_REGION;
+   genCfg->mem.region = MAC_MEM_REGION;
    genCfg->mem.pool   = RG_POOL;
    genCfg->tmrRes     = 10;
    genCfg->numRguSaps = 2;
@@ -699,7 +699,7 @@ S16 duBuildMacGenCfg()
    genCfg->lmPst.srcInst   = macCfgInst;
    genCfg->lmPst.prior     = PRIOR0;
    genCfg->lmPst.route     = RTESPEC;
-   genCfg->lmPst.region    = RG_MEM_REGION;
+   genCfg->lmPst.region    = MAC_MEM_REGION;
    genCfg->lmPst.pool      = RG_POOL;
    genCfg->lmPst.selector  = DU_SELECTOR_LC;
 
@@ -715,7 +715,7 @@ S16 duBuildMacGenCfg()
 
    rgMngmt.hdr.response.prior      = PRIOR0;
    rgMngmt.hdr.response.route      = RTESPEC;
-   rgMngmt.hdr.response.mem.region = RG_MEM_REGION;
+   rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
    rgMngmt.hdr.response.mem.pool   = RG_POOL;
    rgMngmt.hdr.response.selector   = DU_SELECTOR_LC;
 
@@ -762,7 +762,7 @@ S16 duBuildMacUsapCfg(SpId sapId)
 
    uSap   = &(rgMngmt.t.cfg.s.rguSap);
 
-   uSap->mem.region = RG_MEM_REGION;
+   uSap->mem.region = MAC_MEM_REGION;
    uSap->mem.pool   = RG_POOL;
    uSap->suId       = 0;
    uSap->spId       = sapId;
@@ -778,7 +778,7 @@ S16 duBuildMacUsapCfg(SpId sapId)
    rgMngmt.hdr.entId.ent           = ENTRG;
    rgMngmt.hdr.entId.inst          = (Inst)0;
    rgMngmt.hdr.elmId.elmnt         = STRGUSAP;
-   rgMngmt.hdr.response.mem.region = RG_MEM_REGION;
+   rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
    rgMngmt.hdr.response.mem.pool   = RG_POOL;
    
    /* fill pst */
@@ -1367,7 +1367,7 @@ S16 duSendSchCfg()
    /* Filling of Instance Id */
    cfg->instId = DEFAULT_CELLS + 1;
    /* Filling of Gen config */
-   cfg->genCfg.mem.region = RG_MEM_REGION;
+   cfg->genCfg.mem.region = MAC_MEM_REGION;
    cfg->genCfg.mem.pool = RG_POOL;
    cfg->genCfg.tmrRes = 10;
 
@@ -1384,7 +1384,7 @@ S16 duSendSchCfg()
    cfg->genCfg.lmPst.srcInst   = DEFAULT_CELLS + 1;
    cfg->genCfg.lmPst.prior     = PRIOR0;
    cfg->genCfg.lmPst.route     = RTESPEC;
-   cfg->genCfg.lmPst.region    = RG_MEM_REGION;
+   cfg->genCfg.lmPst.region    = MAC_MEM_REGION;
    cfg->genCfg.lmPst.pool      = RG_POOL;
    cfg->genCfg.lmPst.selector  = DU_SELECTOR_LC;
 
@@ -1393,7 +1393,7 @@ S16 duSendSchCfg()
    rgMngmt.hdr.entId.ent           = ENTRG;
    rgMngmt.hdr.entId.inst          = DU_INST;
    rgMngmt.hdr.elmId.elmnt         = STSCHINST;
-   rgMngmt.hdr.response.mem.region = RG_MEM_REGION;
+   rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
    rgMngmt.hdr.response.mem.pool   = RG_POOL;
 
    /* Fill Pst */
@@ -1666,7 +1666,7 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
 #ifdef EGTP_TEST
    duSendEgtpSlotInd();    
 #endif
-   DU_FREE_MEM(pst->region, pst->pool, slotInfo, sizeof(SlotInfo));
+   DU_FREE_MEM(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotInfo));
    return ROK;
 }
 
index fc087db..b336c14 100644 (file)
@@ -74,7 +74,14 @@ S16 l1BldAndSndParamRsp(void *msg)
 #ifdef FAPI
    uint8_t index = 0;
    uint32_t msgLen = 0;
-       fapi_param_resp_t *fapiParamRsp = (fapi_param_resp_t *)msg;
+       fapi_param_resp_t *fapiParamRsp;
+       
+       MAC_ALLOC(fapiParamRsp, sizeof(fapi_param_resp_t));
+       if(!fapiParamRsp)
+       {
+          DU_LOG("PHY STUB: Memory allocation failed");
+               return RFAILED;
+       }
 
   /* Cell Params */
   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RELEASE_CAPABILITY_TAG,                         sizeof(uint16_t), 1, &msgLen);
@@ -147,12 +154,13 @@ S16 l1BldAndSndParamRsp(void *msg)
   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RSSI_MEASUREMENT_SUPPORT_TAG,                    sizeof(uint8_t), 0, &msgLen);
 
   fapiParamRsp->number_of_tlvs = index;
-  msgLen = msgLen + sizeof(fapi_param_resp_t);
-
+  msgLen += sizeof(fapi_param_resp_t) - sizeof(fapi_msg_t);
   fillMsgHeader(&fapiParamRsp->header, FAPI_PARAM_RESPONSE, msgLen);
   fapiParamRsp->error_code = MSG_OK;
+
   DU_LOG("\nPHY_STUB: Sending Param Request to Lower Mac");
   handlePhyMessages(fapiParamRsp->header.message_type_id, sizeof(fapi_param_resp_t), (void *)fapiParamRsp);
+  MAC_FREE(fapiParamRsp, sizeof(fapi_param_resp_t));
 #endif
   return ROK;
 }
@@ -178,20 +186,26 @@ S16 l1BldAndSndConfigRsp(void *msg)
 {
 #ifdef FAPI
    uint32_t msgLen = 0;
-   fapi_config_resp_t *fapiConfigRsp = (fapi_config_resp_t *)msg;
+   fapi_config_resp_t *fapiConfigRsp;
 
-   if(fapiConfigRsp != NULL)
+   MAC_ALLOC(fapiConfigRsp, sizeof(fapi_config_resp_t));
+   if(!fapiConfigRsp)
    {
-      fapiConfigRsp->number_of_invalid_tlvs = NULLP;
-      fapiConfigRsp->number_of_inv_tlvs_idle_only = NULLP;
-      fapiConfigRsp->number_of_missing_tlvs = NULLP;
-      fapiConfigRsp->error_code = MSG_OK;
-      msgLen += sizeof(fapi_config_resp_t);
-      fillMsgHeader(&fapiConfigRsp->header, FAPI_CONFIG_RESPONSE, msgLen);
-      DU_LOG("\nPHY_STUB: Sending Config Response to Lower Mac");
-      handlePhyMessages(fapiConfigRsp->header.message_type_id, sizeof(fapi_config_resp_t), (void *)fapiConfigRsp);
-      return ROK;
+      DU_LOG("PHY STUB: Memory allocation failed");
+      return RFAILED;
    }
+
+   fapiConfigRsp->number_of_invalid_tlvs = NULLP;
+   fapiConfigRsp->number_of_inv_tlvs_idle_only = NULLP;
+   fapiConfigRsp->number_of_missing_tlvs = NULLP;
+   fapiConfigRsp->error_code = MSG_OK;
+       msgLen += sizeof(fapi_param_resp_t) - sizeof(fapi_msg_t);
+   fillMsgHeader(&fapiConfigRsp->header, FAPI_CONFIG_RESPONSE, msgLen);
+
+   DU_LOG("\nPHY_STUB: Sending Config Response to Lower Mac");
+   handlePhyMessages(fapiConfigRsp->header.message_type_id, \
+          sizeof(fapi_config_resp_t), (void *)fapiConfigRsp);
+   MAC_FREE(fapiConfigRsp, sizeof(fapi_config_resp_t));
 #endif
    return ROK;
 }
@@ -215,12 +229,16 @@ S16 l1BldAndSndConfigRsp(void *msg)
 
 PUBLIC void l1HdlParamReq(uint32_t msgLen, void *msg)
 {
+#ifdef FAPI
    DU_LOG("\nPHY_STUB: Received Param Request in PHY");
-   /* Handling PARAM RESPONSE */
+   /* Build and send PARAM RESPONSE */
    if(l1BldAndSndParamRsp(msg)!= ROK)
    {
       DU_LOG("\nPHY_STUB: Failed Sending Param Response");
    }
+       MAC_FREE(msg, sizeof(fapi_param_req_t));
+#endif
 } 
 
 /*******************************************************************
@@ -243,6 +261,10 @@ PUBLIC void l1HdlParamReq(uint32_t msgLen, void *msg)
 
 PUBLIC void l1HdlConfigReq(uint32_t msgLen, void *msg)
 {
+#ifdef FAPI
+   int idx = 0;
+       fapi_config_req_t *configReq = (fapi_config_req_t *)msg;
+
    DU_LOG("\nPHY_STUB: Received Config Request in PHY");
 
    /* Handling CONFIG RESPONSE */
@@ -250,6 +272,24 @@ PUBLIC void l1HdlConfigReq(uint32_t msgLen, void *msg)
    {
       printf("\nPHY_STUB: Failed Sending config Response");
    }
+   
+       while(idx < MAX_NUM_TLVS_CONFIG)
+       {
+          if(configReq->tlvs[idx].tl.tag == FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG)
+               {
+                  if(configReq->tlvs[idx].value)
+                       {
+                          idx++;
+                          MAC_FREE(configReq->tlvs[idx].value , \
+                                  sizeof(uint8_t) * configReq->tlvs[idx-1].value);
+            break;
+                       }
+               }
+               idx++;
+       }
+       MAC_FREE(configReq, sizeof(fapi_config_req_t));
+#endif
+
 }
 
 
@@ -279,7 +319,8 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
    fapi_rach_indication_t  *rachInd;
 
    /* Building RACH indication */
-   if(SGetSBuf(0, 0, (Data **)&rachInd, sizeof(fapi_rach_indication_t)) != ROK)
+       MAC_ALLOC(rachInd, sizeof(fapi_rach_indication_t));
+   if(!rachInd)
    {
       printf("\nPHY_STUB: Memory allocation failed for Rach Indication Message");
       return RFAILED;
@@ -308,7 +349,7 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
    /* Sending RACH indication to MAC */
    DU_LOG("\nPHY STUB: Sending RACH Indication to MAC");
    handlePhyMessages(rachInd->header.message_type_id, sizeof(fapi_rach_indication_t), (void *)rachInd);
-   SPutSBuf(0, 0, (Data *)rachInd, sizeof(fapi_rach_indication_t));
+   MAC_FREE(rachInd, sizeof(fapi_rach_indication_t));
 #endif
    return ROK;
 }
@@ -334,7 +375,9 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
 {
 #ifdef FAPI
    fapi_slot_ind_t *slotIndMsg;
-   if(SGetSBuf(0, 0, (Data **)&slotIndMsg, sizeof(slotIndMsg)) != ROK)
+
+   MAC_ALLOC(slotIndMsg, sizeof(fapi_slot_ind_t));
+       if(!slotIndMsg)
    {
        DU_LOG("\nPHY_STUB: Memory allocation failed for slot Indication Message");
        return RFAILED;
@@ -357,7 +400,7 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
       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);
-      SPutSBuf(0, 0, (Data *)slotIndMsg, sizeof(slotIndMsg));
+      MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t));
    }
 #endif
    return ROK;
@@ -383,19 +426,21 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
 
 PUBLIC S16 l1HdlStartReq(uint32_t msgLen, void *msg)
 {
+#ifdef FAPI
+   fapi_start_req_t *startReq = (fapi_start_req_t *)msg;
+
    if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
    {
       duStartSlotIndicaion();
-#ifdef FAPI
-      SPutSBuf(0, 0, (Data *)msg, sizeof(fapi_start_req_t));
-#endif
-      return ROK;
+               MAC_FREE(startReq, sizeof(fapi_start_req_t));
    }
    else
    {
       DU_LOG("\nPHY_STUB: Received Start Req in PHY State %d", clGlobalCp.phyState);
       return RFAILED;
    }
+#endif
+   return ROK;
 }
 
 /*******************************************************************
@@ -451,6 +496,19 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
                else if(dlTtiReq->pdus[pduCount].pduType == 1)
                   DU_LOG("\nPHY_STUB: PDSCH PDU");
        }
+
+       /* Free FAPI message */
+   for(pduCount = 0; pduCount < dlTtiReq->nPdus; pduCount++)
+       {
+          if(dlTtiReq->pdus[pduCount].pduType == FAPI_DL_TTI_REQ_PDCCH_PDU_TYPE)
+               {
+         MAC_FREE(dlTtiReq->pdus[pduCount].u.pdcch_pdu.dlDci,\
+                          sizeof(fapi_dl_dci_t));
+          }
+   }
+       MAC_FREE(dlTtiReq->pdus, (dlTtiReq->nPdus * sizeof(fapi_dl_tti_req_pdu_t)));
+       MAC_FREE(dlTtiReq, sizeof(fapi_dl_tti_req_t));
+
 #endif
    return ROK;
 }
@@ -476,10 +534,24 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
 PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
 {
 #ifdef FAPI
+   uint8_t pduCount;
+
    DU_LOG("\nPHY STUB: Received TX DATA Request");
 
    fapi_tx_data_req_t *txDataReq;
-   txDataReq = (fapi_dl_tti_req_t *)msg;
+   txDataReq = (fapi_tx_data_req_t *)msg;
+
+#if 0
+   for(pduCount = 0; pduCount< txDataReq->numPdus; pduCount++)
+       {
+      if(txDataReq->pduDesc[pduCount].tlvs[0].value)
+             MAC_FREE((uint32_t *)txDataReq->pduDesc[pduCount].tlvs[0].value,\
+                     txDataReq->pduDesc[pduCount].tlvs[0].tl.length);
+       }
+#endif
+       MAC_FREE(txDataReq->pduDesc, (txDataReq->numPdus * \
+          sizeof(fapi_tx_pdu_desc_t)));
+       MAC_FREE(txDataReq, sizeof(fapi_tx_data_req_t));
 #endif
    return ROK;
 }
@@ -521,6 +593,10 @@ PUBLIC S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg)
                        DU_LOG("\nPHY STUB: PRACH PDU");
                numPdus--;
        }
+
+   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)
    {
       rachIndSent = true;
index 1db65f4..67f66f8 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <time.h>
 #include "lphy_stub.h"
 #include "du_log.h"
 
@@ -28,13 +29,18 @@ uint16_t l1BuildAndSendSlotIndication();
 
 void *GenerateTicks(void *arg)
 {
-   uint8_t counter = 100;
-   while(counter)
+   int     milisec = 1;        /* 1ms */
+   struct timespec req = {0};
+
+   req.tv_sec = 0;
+   req.tv_nsec = milisec * 1000000L;
+
+   while(1)
    {
-      sleep(1);
+      nanosleep(&req, (struct timespec *)NULL);
+      
       /* Send Slot indication indication to lower mac */
       l1BuildAndSendSlotIndication();
-      counter--;
    }
    return((void *)NULLP);
 }