#include "fapi.h"
#include "fapi_vendor_extension.h"
#endif
-#include "lphy_stub.h"
#include "lwr_mac_upr_inf.h"
#include "mac_utils.h"
#include "phy_stub.h"
+#include "phy_stub_utils.h"
+#include "lwr_mac_phy_stub_inf.h"
/*******************************************************************
*
void l1HdlConfigReq(uint32_t msgLen, void *msg)
{
+ memset(&ueDb, 0, sizeof(UeDb));
+
#ifdef INTEL_FAPI
p_fapi_api_queue_elem_t configReqElem = (p_fapi_api_queue_elem_t)msg;
fapi_config_req_t *configReq = (fapi_config_req_t *)(configReqElem +1);
* ****************************************************************/
uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_t puschPdu)
{
- uint8_t idx = 0;
+ uint8_t idx = 0, ueId = 0;
fapi_rx_data_indication_t *rxDataInd =NULLP;
fapi_pdu_ind_info_t *pduInfo =NULLP;
uint8_t *pdu = NULLP;
uint32_t msgLen = 0;
MsgType type = 0;
- if(!msg3Sent)
+ GET_UE_IDX(puschPdu.rnti, ueId);
+ if(!ueDb.ueCb[ueId-1].msg3Sent)
{
- msg3Sent = true;
+ ueDb.ueCb[ueId-1].ueId = ueId;
+ ueDb.ueCb[ueId-1].crnti = puschPdu.rnti;
+ ueDb.ueCb[ueId-1].msg3Sent = true;
type = MSG_TYPE_MSG3;
sleep(2);
}
- else if(!msg5ShortBsrSent)
+ else if(!ueDb.ueCb[ueId-1].msg5ShortBsrSent)
{
- msg5ShortBsrSent = true;
+ ueDb.ueCb[ueId-1].msg5ShortBsrSent = true;
type = MSG_TYPE_SHORT_BSR;
}
- else if(!msg5Sent)
+ else if(!ueDb.ueCb[ueId-1].msg5Sent)
{
- msg5Sent = true;
+ ueDb.ueCb[ueId-1].msg5Sent = true;
type = MSG_TYPE_MSG5;
}
- else if(!msgRegistrationComp)
+ else if(!ueDb.ueCb[ueId-1].msgRegistrationComp)
{
- msgRegistrationComp = true;
+ ueDb.ueCb[ueId-1].msgRegistrationComp = true;
type = MSG_TYPE_REGISTRATION_COMPLETE;
}
- else if(!msgSecurityModeComp)
+ else if(!ueDb.ueCb[ueId-1].msgSecurityModeComp)
{
- msgSecurityModeComp = true;
+ ueDb.ueCb[ueId-1].msgSecurityModeComp = true;
type = MSG_TYPE_SECURITY_MODE_COMPLETE;
}
- else if(!msgRrcReconfiguration)
+ else if(!ueDb.ueCb[ueId-1].msgRrcReconfiguration)
{
- msgRrcReconfiguration = true;
+ ueDb.ueCb[ueId-1].msgRrcReconfiguration = true;
type = MSG_TYPE_RRC_RECONFIG_COMPLETE;
}
else
* ****************************************************************/
uint16_t l1BuildAndSendSlotIndication()
{
+ Pst pst;
+ Buffer *mBuf;
+
#ifdef INTEL_FAPI
fapi_slot_ind_t *slotIndMsg;
- MAC_ALLOC(slotIndMsg, sizeof(fapi_slot_ind_t));
+ MAC_ALLOC_SHRABL_BUF(slotIndMsg, sizeof(fapi_slot_ind_t));
if(!slotIndMsg)
{
DU_LOG("\nERROR --> PHY_STUB: Memory allocation failed for slot Indication Message");
slotIndMsg->slot = slotValue;
#ifdef ODU_SLOT_IND_DEBUG_LOG
- DU_LOG("\n\nDEBUG --> PHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue);
+ DU_LOG("\n\nDEBUG --> PHY_STUB: Sending Slot Indication [%d : %d] to MAC", sfnValue, slotValue);
#endif
+
/* increment for the next TTI */
slotValue++;
if(sfnValue >= MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE)
{
- sfnValue = 0;
- slotValue = 0;
+ sfnValue = 0;
+ slotValue = 0;
}
else if(slotValue > MAX_SLOT_VALUE)
{
- sfnValue++;
- slotValue = 0;
+ sfnValue++;
+ slotValue = 0;
}
fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, \
- sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t));
- procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
- MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t));
+ sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t));
+
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_PHY_STUB_TO_LWR_MAC(pst, EVT_PHY_STUB_SLOT_IND);
+
+ ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf);
+ if(!mBuf)
+ {
+ DU_LOG("\nERROR --> PHY_STUB: Failed to allocate memory for slot indication buffer");
+ MAC_FREE_SHRABL_BUF(pst.region, pst.pool, slotIndMsg, sizeof(fapi_slot_ind_t));
+ return RFAILED;
+ }
+ CMCHKPK(oduPackPointer, (PTR)slotIndMsg, mBuf);
+ ODU_POST_TASK(&pst, mBuf);
}
#endif
return ROK;
}
else if(dlTtiReq->pdus[pduCount].pduType == 0)
{
- DU_LOG("\nINFO --> PHY_STUB: PDCCH PDU");
- if(dlTtiReq->pdus[pduCount].pdu.pdcch_pdu.\
- coreSetType == 1)
- {
- dlDedMsg = true;
- }
+ DU_LOG("\nINFO --> PHY_STUB: PDCCH PDU");
}
else if(dlTtiReq->pdus[pduCount].pduType == 1)
{
fapi_tx_data_req_t *txDataReq = (fapi_tx_data_req_t *)(txDataElem +1);
DU_LOG("\nINFO --> PHY STUB: TX DATA Request at sfn=%d slot=%d",txDataReq->sfn,txDataReq->slot);
+/*
if(dlDedMsg)
{
DU_LOG("\nINFO --> PHY_STUB: TxDataPdu for DED MSG sent");
dlDedMsg = false;
}
+*/
MAC_FREE(msg, msgLen);
#endif
return ROK;
numPdus--;
}
- if(rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6)
+ if(ueDb.ueCb[ueDb.numActvUe].rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6)
{
- rachIndSent = true;
+ ueDb.ueCb[ueDb.numActvUe].rachIndSent = true;
l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ ueDb.numActvUe++;
}
+ //Following can be enabled to test with a second UE
+#if 0
+ if(ueDb.ueCb[ueDb.numActvUe].rachIndSent == false && ulTtiReq->sfn == 304 && ulTtiReq->slot == 0)
+ {
+ ueDb.ueCb[ueDb.numActvUe].rachIndSent = true;
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ ueDb.numActvUe++;
+ }
+#endif
+
MAC_FREE(msg, msgLen);
#endif
return ROK;
uint16_t l1BuildAndSendStopInd()
{
#ifdef INTEL_FAPI
+ Pst pst;
+ Buffer *mBuf = NULLP;
fapi_stop_ind_t *stopIndMsg = NULLP;
uint32_t msgLen = 0;
- MAC_ALLOC(stopIndMsg, sizeof(fapi_stop_ind_t));
+ MAC_ALLOC_SHRABL_BUF(stopIndMsg, sizeof(fapi_stop_ind_t));
if(!stopIndMsg)
{
DU_LOG("\nERROR --> PHY_STUB: Memory allocation failed for stop Indication Message");
{
fillMsgHeader(&stopIndMsg->header, FAPI_STOP_INDICATION, msgLen);
DU_LOG("\n\nINFO --> PHY_STUB: Processing Stop indication to MAC");
- procPhyMessages(stopIndMsg->header.msg_id,\
- sizeof(fapi_stop_ind_t), (void*)stopIndMsg);
- MAC_FREE(stopIndMsg, sizeof(fapi_stop_ind_t));
+
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_PHY_STUB_TO_LWR_MAC(pst, EVT_PHY_STUB_STOP_IND);
+ ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf);
+ if(!mBuf)
+ {
+ DU_LOG("\nERROR --> PHY_STUB: Failed to allocate memory for slot indication buffer");
+ MAC_FREE_SHRABL_BUF(pst.region, pst.pool, stopIndMsg, sizeof(fapi_stop_ind_t));
+ return RFAILED;
+ }
+ CMCHKPK(oduPackPointer, (PTR)stopIndMsg, mBuf);
+ ODU_POST_TASK(&pst, mBuf);
}
#endif
return ROK;
if(lwrMacCb.phyState == PHY_STATE_RUNNING)
{
l1HdlSlotIndicaion(TRUE);
+
+ /* Initialize all global variables */
+ sfnValue = 0;
+ slotValue = 0;
+ memset(&ueDb, 0, sizeof(UeDb));
+
DU_LOG("\nINFO --> PHY_STUB: Slot Indication is stopped successfully");
- l1BuildAndSendStopInd();
MAC_FREE(msg, msgLen);
}
else
return ROK;
}
+#if 0
/*******************************************************************
*
* @brief Build And Send Rx Data Ind for Msg5
#endif
return ROK;
}
+#endif
/*******************************************************************
*
{
#ifdef INTEL_FAPI
case FAPI_PARAM_REQUEST:
- l1HdlParamReq(msgLen, msg);
- break;
+ l1HdlParamReq(msgLen, msg);
+ break;
case FAPI_CONFIG_REQUEST:
- l1HdlConfigReq(msgLen, msg);
- break;
+ l1HdlConfigReq(msgLen, msg);
+ break;
case FAPI_START_REQUEST:
- l1HdlStartReq(msgLen, msg);
- break;
+ l1HdlStartReq(msgLen, msg);
+ break;
case FAPI_DL_TTI_REQUEST:
- l1HdlDlTtiReq(msgLen, msg);
- break;
+ l1HdlDlTtiReq(msgLen, msg);
+ break;
case FAPI_TX_DATA_REQUEST:
- l1HdlTxDataReq(msgLen, msg);
- break;
+ l1HdlTxDataReq(msgLen, msg);
+ break;
case FAPI_UL_TTI_REQUEST:
- l1HdlUlTtiReq(msgLen, msg);
- break;
+ l1HdlUlTtiReq(msgLen, msg);
+ break;
case FAPI_STOP_REQUEST:
- l1HdlStopReq(msgLen, msg);
- break;
+ l1HdlStopReq(msgLen, msg);
+ break;
case FAPI_UL_DCI_REQUEST:
- l1HdlUlDciReq(msgLen, msg);
- break;
+ l1HdlUlDciReq(msgLen, msg);
+ break;
default:
- DU_LOG("\nERROR --> PHY_STUB: Invalid message type[%x] received at PHY", msgType);
- break;
+ DU_LOG("\nERROR --> PHY_STUB: Invalid message type[%x] received at PHY", msgType);
+ break;
#endif
}
}