if(paramReq != NULLP)
{
fillMsgHeader(¶mReq->header, FAPI_PARAM_REQUEST, msgLen);
- DU_LOG("\nLOWER MAC: sending param Req to Phy");
+ 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;
}
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");
LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
MAC_FREE(ulTtiReqPdu, (ulTtiReq->nPdus * sizeof(fapi_ul_tti_req_pdu_t)));
}
{
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");
LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgLen, (void *)ulTtiReq);
}
MAC_FREE(ulTtiReq, sizeof(fapi_ul_tti_req_t));
#include "du_log.h"
#include "lwr_mac_fsm.h"
#include "lwr_mac_phy.h"
+#include "lwr_mac_upr_inf.h"
#ifdef FAPI
-
-/* function pointers for packing macCellCfg Request */
-typedef S16 (*packSlotIndMsg) ARGS((
- Pst *pst,
- SlotIndInfo *slotInd
-));
-
-S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
-S16 packTcSlotInd (Pst *pst, SlotIndInfo *slotInd);
-S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd);
-
+/* Function pointer for slot indication from lower mac to mac */
packSlotIndMsg packSlotIndOpts[] =
{
- packLcSlotInd, /* packing for loosely coupled */
+ packLcSlotInd, /* packing for loosely coupled */
fapiMacSlotInd, /* packing for tightly coupled */
- packLwlcSlotInd, /* packing for light weight loosly coupled */
+ packLwlcSlotInd /* packing for light weight loosly coupled */
};
-S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
-{
- Buffer *mBuf = NULLP;
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- RETVALUE(RFAILED);
- }
-
- /* pack SFN and slot value */
- CMCHKPK(SPkU16,slotInd->sfn, mBuf);
- CMCHKPK(SPkU16,slotInd->slot, mBuf);
-
- RETVALUE(SPstTsk(pst,mBuf));
-}
-
-S16 packTcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+/* Function pointer for rach indication from lower mac to mac */
+packRachIndMsg sendRachIndOpts[] =
{
- return ROK;
-}
+ packRachInd,
+ fapiMacRachInd,
+ packRachInd
+};
-S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+/*******************************************************************
+ *
+ * @brief Fills post structure
+ *
+ * @details
+ *
+ * Function : fillLwrMacToMacPst
+ *
+ * Functionality:
+ * Fills post structure used to send message from lower MAC
+ * to MAC
+ *
+ * @params[in] Pst pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void fillLwrMacToMacPst(Pst *pst)
{
- return ROK;
+ pst->srcProcId = 0;
+ pst->dstProcId = 0;
+ pst->srcEnt = ENTTF;
+ pst->dstEnt = ENTRG;
+ pst->srcInst = 0;
+ pst->dstInst = 0;
+ pst->region = 0;
+ pst->pool = 0;
+ pst->selector = MAC_SELECTOR_TC;
}
+/*******************************************************************
+ *
+ * @brief Processes Slot Indication from PHY and sends to MAC
+ *
+ * @details
+ *
+ * Function : handleSlotInd
+ *
+ * Functionality:
+ * Processes Slot Indication from PHY and sends to MAC
+ *
+ * @params[in] fapi_slot_ind_t pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
{
/* fill Pst structure to send to lwr_mac to MAC */
uint16_t ret;
SlotIndInfo slotInd;
- pst.srcProcId = 0;
- pst.dstProcId = 0;
- pst.srcEnt = ENTTF;
- pst.dstEnt = ENTRG;
- pst.srcInst = 0;
- pst.dstInst = 0;
+ fillLwrMacToMacPst(&pst);
pst.event = EVENT_SLOT_IND_TO_MAC;
- pst.region = 0;
- pst.pool = 0;
- pst.selector = MAC_SELECTOR_TC;
slotInd.sfn = fapiSlotInd->sfn;
slotInd.slot = fapiSlotInd->slot;
return ret;
}
-#endif
+
+
+/*******************************************************************
+ *
+ * @brief Processes Rach Indication from PHY and sends to MAC
+ *
+ * @details
+ *
+ * Function : handleRachInd
+ *
+ * Functionality:
+ * Processes Rach Indication from PHY and sends to MAC
+ *
+ * @params[in] fapi_rach_indication_t pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t handleRachInd(fapi_rach_indication_t *fapiRachInd)
+{
+ Pst pst;
+ uint8_t pduIdx;
+ uint8_t prmbleIdx;
+ RachPduInfo *rachPdu;
+ RachInd rachInd;
+
+ rachInd.timingInfo.sfn = fapiRachInd->sfn;
+ rachInd.timingInfo.slot = fapiRachInd->slot;
+ rachInd.numPdu = fapiRachInd->numPdus;
+ for(pduIdx=0; pduIdx < rachInd.numPdu; pduIdx++)
+ {
+ rachPdu = &rachInd.rachPdu[pduIdx];
+ rachPdu->pci = fapiRachInd->rachPdu[pduIdx].physCellId;
+ rachPdu->symbolIdx = fapiRachInd->rachPdu[pduIdx].symbolIndex;
+ rachPdu->slotIdx = fapiRachInd->rachPdu[pduIdx].slotIndex;
+ rachPdu->freqIdx = fapiRachInd->rachPdu[pduIdx].freqIndex;
+ rachPdu->numPream = fapiRachInd->rachPdu[pduIdx].numPreamble;
+ for(prmbleIdx=0; prmbleIdx<rachPdu->numPream; prmbleIdx++)
+ {
+ rachPdu->preamInfo[prmbleIdx].preamIdx = \
+ fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].preambleIndex;
+ rachPdu->preamInfo[prmbleIdx].timingAdv = \
+ fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].timingAdvance;
+ }
+ }
+ fillLwrMacToMacPst(&pst);
+ pst.event = EVENT_RACH_IND_TO_MAC;
+
+ (*sendRachIndOpts[pst.selector])(&pst, &rachInd);
+ return ROK;
+
+}/* handleRachInd */
+
+#endif /* FAPI */
void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
{
{
if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
{
- DU_LOG("\nLOWER MAC: PHY has moved to running state \n");
+ DU_LOG("\nLOWER MAC: PHY has moved to running state");
clGlobalCp.phyState = PHY_STATE_RUNNING;
}
}
case FAPI_RACH_INDICATION:
{
+ fapi_rach_indication_t *rachInd;
+ rachInd = (fapi_rach_indication_t *)msg;
+ handleRachInd(rachInd);
break;
}
}
#endif
EXTERN S16 rgClHndlCfgReq ARGS((void *msg));
-EXTERN void processFapiRequest ARGS((uint8_t msgType, uint32_t msgLen, void *msg));
+EXTERN void l1ProcessFapiRequest ARGS((uint8_t msgType, uint32_t msgLen, void *msg));
#ifdef INTEL_WLS
addWlsBlockToFree(msg, msgLen, (slotIndIdx-1));
}
#else
- processFapiRequest(msgType, msgLen, msg);
+ l1ProcessFapiRequest(msgType, msgLen, msg);
#endif
return ROK;
} /* LwrMacSendToPhy */
--- /dev/null
+/*******************************************************************************
+################################################################################
+# Copyright (c) [2017-2019] [Radisys] #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+################################################################################
+*******************************************************************************/
+
+#include "lwr_mac_upr_inf.h"
+
+/*******************************************************************
+ *
+ * @brief Packs and Sends RACH Ind to MAC
+ *
+ * @details
+ *
+ * Function : packRachInd
+ *
+ * Functionality:
+ * Packs and Sends RACH Ind to MAC
+ *
+ * @params[in] Post structure pointer
+ * RACH indication
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t packRachInd(Pst *pst, RachInd *rachInd)
+{
+ if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
+ {
+ return ROK;
+ }
+ else
+ {
+ return RFAILED;
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Loose coupled packing of slot indication
+ *
+ * @details
+ *
+ * Function : packLcSlotInd
+ *
+ * Functionality:
+ * Loose coupled packing of slot indication
+ *
+ * @params[in] Post structure
+ * Slot indication info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+{
+ Buffer *mBuf = NULLP;
+ if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ RETVALUE(RFAILED);
+ }
+
+ /* pack SFN and slot value */
+ CMCHKPK(SPkU16,slotInd->sfn, mBuf);
+ CMCHKPK(SPkU16,slotInd->slot, mBuf);
+
+ RETVALUE(SPstTsk(pst,mBuf));
+}
+
+/*******************************************************************
+ *
+ * @brief Light weight loose coupled packing of slot indication
+ *
+ * @details
+ *
+ * Function : packLwlcSlotInd
+ *
+ * Functionality:
+ * Light weight loose coupled packing of slot indication
+ *
+ * @params[in] Post structure
+ * Slot indication info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+{
+ return ROK;
+}
+
+/**********************************************************************
+ End of file
+**********************************************************************/
--- /dev/null
+/*******************************************************************************
+################################################################################
+# Copyright (c) [2017-2019] [Radisys] #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+################################################################################
+*******************************************************************************/
+
+/* header include files -- defines (.h) */
+
+#ifndef __LWR_MAC_UPR_INF_H__
+#define __LWR_MAC_UPR_INF_H__
+
+#include "envopt.h" /* environment options */
+#include "envdep.h" /* environment dependent */
+#include "envind.h" /* environment independent */
+#include "gen.h" /* general layer */
+#include "ssi.h" /* system services */
+#include "cm5.h" /* common timers defines */
+#include "cm_hash.h" /* common hash list defines */
+#include "cm_llist.h" /* common linked list defines */
+#include "cm_mblk.h" /* memory management */
+#include "cm_tkns.h" /* common tokens */
+#include "cm_lte.h" /* common tokens */
+#include "tfu.h"
+
+/* header/extern include files (.x) */
+#include "gen.x" /* general layer typedefs */
+#include "ssi.x" /* system services typedefs */
+#include "cm5.x" /* common timers */
+#include "cm_hash.x" /* common hash list */
+#include "cm_lib.x" /* common library */
+#include "cm_llist.x" /* common linked list */
+#include "cm_mblk.x" /* memory management */
+#include "cm_tkns.x" /* common tokens */
+#include "cm_lte.x" /* common tokens */
+#include "tfu.x"
+
+typedef S16 (*packSlotIndMsg)(Pst *pst, SlotIndInfo *slotInd);
+S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
+S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd);
+
+typedef uint16_t (*packRachIndMsg)(Pst *pst, RachInd *rachInd);
+uint16_t packRachInd(Pst *pst, RachInd *rachInd);
+uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
+
+#endif
+/**********************************************************************
+ End of file
+**********************************************************************/
typedef struct macCellCb
{
uint16_t cellId;
+ RachIndInfo raCb;
MacDlSlot dlSlot[MAX_SLOT_SUPPORTED];
MacUlSlot ulSlot[MAX_SLOT_SUPPORTED];
}MacCellCb;
/* global variable */
EXTERN MacCb macCb;
+void fillMacToSchPst(Pst *pst);
#endif
/**********************************************************************
#include "lrg.x"
#include "du_app_mac_inf.h"
#include "mac.h"
+#include "du_log.h"
+/* Function pointer for sending rach ind from MAC to SCH */
+MacSchRachIndFunc macSchRachIndOpts[]=
+{
+ packMacSchRachInd,
+ macSchRachInd,
+ packMacSchRachInd
+};
+
+
+/*******************************************************************
+ *
+ * @brief Sends RACH indication to SCH
+ *
+ * @details
+ *
+ * Function : sendRachIndMacToSch
+ *
+ * Functionality:
+ * Sends RACH indication to SCH
+ *
+ * @params[in] RACH indication info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int sendRachIndMacToSch(RachIndInfo *rachInd)
+{
+ Pst pst;
+
+ fillMacToSchPst(&pst);
+ pst.event = EVENT_RACH_IND_TO_SCH;
+
+ return(*macSchRachIndOpts[pst.selector])(&pst, rachInd);
+}
+
+/*******************************************************************
+ *
+ * @brief Processes RACH indication from PHY
+ *
+ * @details
+ *
+ * Function : fapiMacRachInd
+ *
+ * Functionality:
+ * Processes RACH indication from PHY
+ *
+ * @params[in] Post structure
+ * Rach indication message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
+{
+ uint8_t pduIdx;
+ uint8_t preambleIdx;
+ RachIndInfo *rachIndInfo;
+
+ DU_LOG("\nMAC : Received RACH indication");
+ /* Considering one pdu and one preamble */
+ pduIdx = 0;
+ preambleIdx = 0;
+
+ rachIndInfo = &macCb.macCell->raCb;
+
+ rachIndInfo->cellId = rachInd->rachPdu[pduIdx].pci;
+ /* TODO : Allocate unique crnti for each ue */
+ rachIndInfo->crnti = 100;
+ rachIndInfo->timingInfo.sfn = rachInd->timingInfo.sfn;
+ rachIndInfo->timingInfo.slot = rachInd->timingInfo.slot;
+ rachIndInfo->slotIdx = rachInd->rachPdu[pduIdx].slotIdx;
+ rachIndInfo->symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx;
+ rachIndInfo->frequencyIdx = rachInd->rachPdu[pduIdx].freqIdx;
+ rachIndInfo->preambleIdx = \
+ rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx;
+ rachIndInfo->timingAdv = \
+ rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
+
+ return(sendRachIndMacToSch(rachIndInfo));
+}
+
/* spec-38.211 Table 6.3.3.1-7 */
uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] =
{0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
} /* rgLIMTfuDatReq*/
#endif /*L2_OPTMZ */
+/*******************************************************************
+ *
+ * @brief Fills post structure
+ *
+ * @details
+ *
+ * Function : fillMacToSchPst
+ *
+ * Functionality:
+ * Fills post structure to be used when sending msg from
+ * MAC to SCH
+ *
+ * @params[in] Post structure pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void fillMacToSchPst(Pst *pst)
+{
+ pst->srcProcId = 0;
+ pst->dstProcId = 0;
+ pst->srcEnt = ENTRG;
+ pst->dstEnt = ENTRG;
+ pst->srcInst = 0;
+ pst->dstInst = 1;
+ pst->region = 0;
+ pst->pool = 0;
+ pst->selector = MAC_SELECTOR_TC;
+}
+
+/*******************************************************************
+ *
+ * @brief MAC handler for config response from PHY
+ *
+ * @details
+ *
+ * Function : fapiMacConfigRsp
+ *
+ * Functionality:
+ * Processes config response from PHY and sends cell config
+ * confirm to DU APP
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
void fapiMacConfigRsp()
{
- /* TODO : Processing of conig response from PHY */
+ /* TODO : Processing of config response from PHY */
/* Send cell config cfm to DU APP */
MacSendCellCfgCfm(RSP_OK);
{
/* fill Pst structure to send to lwr_mac to MAC */
Pst pst;
- pst.srcProcId = 0;
- pst.dstProcId = 0;
- pst.srcEnt = ENTRG;
- pst.dstEnt = ENTRG;
- pst.srcInst = 0;
- pst.dstInst = 1;
+
+ fillMacToSchPst(&pst);
pst.event = EVENT_SLOT_IND_TO_SCH;
- pst.region = 0;
- pst.pool = 0;
- pst.selector = MAC_SELECTOR_TC;
return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd);
}
RETVALUE(ROK);
} /* macSchSlotInd */
+/*******************************************************************
+ *
+ * @brief Processes Rach indication from MAC
+ *
+ * @details
+ *
+ * Function : macSchRachInd
+ *
+ * Functionality:
+ * Processes Rach indication from MAC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int macSchRachInd(Pst *pst, RachIndInfo *rachInd)
+{
+ DU_LOG("\nSCH : Received Rach indication");
+ return ROK;
+}
+
/**
* @brief inti cellCb based on cellCfg
*
RETVALUE(SPstTsk(pst,mBuf));
}
+int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd)
+{
+ if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
+ {
+ /* TODO */
+ }
+ else
+ {
+ return RFAILED;
+ }
+ return ROK;
+}
/**
* @brief function to pack DL Broadcast allocation message
* from MAC to SCH
PrachSchInfo prachSchInfo; /* Prach scheduling info */
}UlSchInfo;
+typedef struct rachIndInfo
+{
+ uint16_t cellId;
+ uint16_t crnti;
+ SlotIndInfo timingInfo;
+ uint8_t slotIdx;
+ uint8_t symbolIdx;
+ uint8_t frequencyIdx;
+ uint8_t preambleIdx;
+ uint16_t timingAdv;
+}RachIndInfo;
+
/* function pointers */
typedef int (*SchCellCfgCfmFunc) ARGS((
EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
+typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
+int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
+int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
/**********************************************************************
End of file
#define EVTTFUNONRTIND 24 /*!< Non-RT indication.*/
#endif
#define EVTTFUERRIND 25 /*!< TFU Error Indication */
+#define EVENT_RACH_IND_TO_MAC 26
+#define EVENT_RACH_IND_TO_SCH 27
/** @} */
+#define MAX_PREAM_PER_SLOT 1 /* Max number of preamble per slot */
+#define MAC_RACH_PDU_PER_SLOT 1 /* Max number of rach pdu per slot */
+
/* selector(coupling) values */
#define TFU_SEL_TC 1 /*!< Selector for Tight coupling. */
#define TFU_SEL_LC 0 /*!< Selector for Loose coupling. */
U16 slot;
}SlotIndInfo;
+typedef struct rachPreamInfo
+{
+ uint8_t preamIdx;
+ uint16_t timingAdv;
+}RachPreamInfo;
+
+typedef struct rachPduInfo
+{
+ uint16_t pci;
+ uint8_t symbolIdx;
+ uint8_t slotIdx;
+ uint8_t freqIdx;
+ uint8_t numPream;
+ RachPreamInfo preamInfo[MAX_PREAM_PER_SLOT];
+}RachPduInfo;
+
+typedef struct rachInd
+{
+ SlotIndInfo timingInfo;
+ uint8_t numPdu;
+ RachPduInfo rachPdu[MAC_RACH_PDU_PER_SLOT];
+}RachInd;
+
typedef S16 (*TfuBndReq) ARGS((
Pst* pst,
SuId suId,
#include "fapi.h"
#endif
#include "lphy_stub.h"
+#include "stdbool.h"
#include "du_log.h"
#include "rg.h"
#define MAX_SLOT_VALUE 9
#define MAX_SFN_VALUE 1023
+#define NR_PCI 1
uint16_t sfnValue = 0;
uint16_t slotValue = 0;
+bool rachIndSent = false;
+
EXTERN void phyToMac ARGS((uint16_t msgType, uint32_t msgLen,void *msg));
#ifdef FAPI
EXTERN void fillTlvs ARGS((fapi_uint16_tlv_t *tlv, uint16_t tag, uint16_t
}
}
+
+/*******************************************************************
+ *
+ * @brief Builds and Sends RACH indication to MAC
+ *
+ * @details
+ *
+ * Function : l1BuildAndSendRachInd
+ *
+ * Functionality:
+ * Builds and Sends RACH indication to MAC
+ *
+ * @params[in] SFN value
+ * slot value
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
+{
+#ifdef FAPI
+ uint8_t rachPduIdx = 0;
+ uint8_t preamIdx = 0;
+ fapi_rach_pdu_t *rachPdu;
+ fapi_rach_indication_t *rachInd;
+
+ /* Building RACH indication */
+ if(SGetSBuf(0, 0, (Data **)&rachInd, sizeof(fapi_rach_indication_t)) != ROK)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for Rach Indication Message");
+ return RFAILED;
+ }
+
+ rachInd->sfn = sfn;
+ rachInd->slot = slot;
+ rachInd->numPdus = 1;
+
+ rachPdu = &rachInd->rachPdu[rachPduIdx];
+ rachPdu->physCellId = NR_PCI;
+ rachPdu->symbolIndex = 0;
+ rachPdu->slotIndex = slot;
+ rachPdu->freqIndex = 0;
+ rachPdu->avgRssi = 0;
+ rachPdu->avgSnr = 0;
+ rachPdu->numPreamble = 1;
+
+ rachPdu->preambleInfo[preamIdx].preambleIndex = 3;
+ rachPdu->preambleInfo[preamIdx].timingAdvance = 0;
+ rachPdu->preambleInfo[preamIdx].premblePwr = 0;
+
+ fillMsgHeader(&rachInd->header, FAPI_RACH_INDICATION, \
+ sizeof(fapi_rach_indication_t));
+
+ /* 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));
+#endif
+ return ROK;
+}
+
/*******************************************************************
*
* @brief Builds and Send the Slot Indication message to MAC
*
* @details
*
- * Function : buildAndSendSlotIndication
+ * Function : l1BuildAndSendSlotIndication
*
* Functionality:
* -Send the Slot indication Message to MAC
* @return void
*
* ****************************************************************/
-PUBLIC S16 buildAndSendSlotIndication()
+PUBLIC uint16_t l1BuildAndSendSlotIndication()
{
#ifdef FAPI
fapi_slot_ind_t *slotIndMsg;
slotIndMsg->sfn = sfnValue;
slotIndMsg->slot = slotValue;
fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, sizeof(fapi_slot_ind_t));
- DU_LOG("\nPHY_STUB [%d:%d] ",sfnValue,slotValue);
+ DU_LOG("\nPHY_STUB: [%d:%d] ",sfnValue,slotValue);
handlePhyMessages(slotIndMsg->header.message_type_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
SPutSBuf(0, 0, (Data *)slotIndMsg, sizeof(slotIndMsg));
}
}
else
{
- DU_LOG("\n PHY_STUB: Received Start Req in PHY State %d", clGlobalCp.phyState);
+ DU_LOG("\nPHY_STUB: Received Start Req in PHY State %d", clGlobalCp.phyState);
return RFAILED;
}
}
#ifdef FAPI
fapi_dl_tti_req_t *dlTtiReq;
dlTtiReq = (fapi_dl_tti_req_t *)msg;
+
+ printf("\nPHY STUB: Received DL TTI Request");
#if 0
- printf("\nPHY_STUB: Received DL TTI Request in PHY");
printf("\nPHY_STUB: SFN %d", dlTtiReq->sfn);
printf("\nPHY_STUB: SLOT %d", dlTtiReq->slot);
printf("\nPHY_STUB: nPdus %d", dlTtiReq->nPdus);
uint8_t numPdus = dlTtiReq->nPdus;
if(numPdus == 0)
{
- DU_LOG("\nNo PDU \n");
+ DU_LOG("\nPHY_STUB: No PDU in DL TTI Request");
}
while(numPdus)
{
if(dlTtiReq->pdus->pduType == 3) //SSB_PDU_TYPE
- DU_LOG("\nSSB PDU\n");
+ DU_LOG("\nPHY_STUB: SSB PDU");
else if(dlTtiReq->pdus->pduType == 0)
- DU_LOG("\nSIB1 PDCCH PDU\n");
+ DU_LOG("\nPHY_STUB: SIB1 PDCCH PDU");
else if(dlTtiReq->pdus->pduType == 1)
- DU_LOG("\nSIB1 PDSCH PDU\n");
+ DU_LOG("\nPHY_STUB: SIB1 PDSCH PDU");
numPdus--;
}
{
#ifdef FAPI
fapi_ul_tti_req_t *ulTtiReq;
+
+ DU_LOG("\nPHY STUB: Received UL TTI Request");
+
ulTtiReq = (fapi_ul_tti_req_t *)msg;
uint8_t numPdus = ulTtiReq->nPdus;
+
if(numPdus == 0)
{
- DU_LOG("\nPHY STUB: No PDU in UL TTI \n");
+ DU_LOG("\nPHY STUB: No PDU in UL TTI");
}
while(numPdus)
{
if(ulTtiReq->pdus->pduType == 0)
- DU_LOG("\n PHY STUB: PRACH PDU\n");
+ DU_LOG("\nPHY STUB: PRACH PDU");
numPdus--;
}
+ if(rachIndSent == false && ulTtiReq->slot == 8)
+ {
+ rachIndSent = true;
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ }
+
MAC_FREE(ulTtiReq, sizeof(fapi_ul_tti_req_t));
#endif
return ROK;
*
* @details
*
- * Function : processFapiRequest
+ * Function : l1ProcessFapiRequest
*
* Functionality:
* - Receives message from MAC and calls handler
*
* ****************************************************************/
-void processFapiRequest(uint8_t msgType, uint32_t msgLen, void *msg)
+void l1ProcessFapiRequest(uint8_t msgType, uint32_t msgLen, void *msg)
{
switch(msgType)
{
#include "lphy_stub.h"
#include "du_log.h"
+uint16_t l1BuildAndSendSlotIndication();
+
void *GenerateTicks(void *arg)
{
uint8_t counter = 100;
while(counter)
{
sleep(1);
- DU_LOG("\nPHY_STUB: SLOT indication");
+ DU_LOG("\n\nPHY_STUB: SLOT indication");
/* Send Slot indication indication to lower mac */
- buildAndSendSlotIndication();
+ l1BuildAndSendSlotIndication();
counter--;
}
}