/* Events in Lower Mac */
typedef enum{
- FAPI_PARAM_REQUEST,
- FAPI_PARAM_RESPONSE,
- FAPI_CONFIG_REQUEST,
- FAPI_CONFIG_RESPONSE,
- FAPI_START_REQUEST,
- FAPI_STOP_REQUEST,
+ PARAM_REQUEST,
+ PARAM_RESPONSE,
+ CONFIG_REQUEST,
+ CONFIG_RESPONSE,
+ START_REQUEST,
+ STOP_REQUEST,
MAX_EVENT
}EventState;
typedef enum
{
- RELEASE_15
+ FAPI_RELEASE_15
}ReleaseCapab;
typedef enum
}
MAC_FREE(cellParam, sizeof(ClCellParam));
MAC_FREE(paramRsp, sizeof(fapi_param_resp_t));
+
+ sendToLowerMac(FAPI_CONFIG_REQUEST, 0, (void *)NULL);
return ROK;
}
else
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);
+ sizeof(uint8_t), *(macCfgParams.prachCfg.fdm[0].unsuedRootSeq), &msgLen);
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);
{
DU_LOG("\nLOWER MAC: PHY has moved to Conigured 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;
}
S16 lwr_mac_handleStartReqEvt(void *msg)
{
-#ifdef FAPi
+#ifdef FAPI
uint32_t msgLen = 0;
fapi_start_req_t *startReq;
MAC_ALLOC(startReq, sizeof(fapi_start_req_t));
#include "cm_mblk.x" /* Common LTE Defines */
#include "tfu.x" /* RGU Interface includes */
//#include "rg.x"
+#include "lwr_mac.h"
+#include "du_log.h"
#ifdef FAPI
/* function pointers for packing macCellCfg Request */
{
case FAPI_SLOT_INDICATION:
{
+ if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
+ {
+ DU_LOG("\nLOWER MAC: PHY has moved to running state \n");
+ clGlobalCp.phyState = PHY_STATE_RUNNING;
+ }
+
fapi_slot_ind_t *slotInd;
slotInd = (fapi_slot_ind_t *)msg;
handleSlotInd(slotInd);
typedef struct macCellCb
{
+ uint16_t cellId;
MacDlSlot dlSlot[MAX_SLOT_SUPPORTED];
}MacCellCb;
typedef struct macCb
{
+ Inst macInst;
MacCellCb *macCell;
}MacCb;
/* global variable */
-MacCb macCb;
+EXTERN MacCb macCb;
#endif
/**********************************************************************
uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo)
{
DU_LOG("\nMAC : Handling cell start request");
- sendToLowerMac(FAPI_START_REQUEST, 0, cellStartInfo);
+ sendToLowerMac(START_REQUEST, 0, cellStartInfo);
MAC_FREE_MEM(pst->region, pst->pool, cellStartInfo, \
sizeof(MacCellStartInfo));
* ****************************************************************/
uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo)
{
- DU_LOG("\nMAC : Handling cell start request");
- sendToLowerMac(FAPI_STOP_REQUEST, 0, cellStopInfo);
+ DU_LOG("\nMAC : Handling cell stop request");
+ sendToLowerMac(STOP_REQUEST, 0, cellStopInfo);
MAC_FREE_MEM(pst->region, pst->pool, cellStopInfo, \
sizeof(MacCellStopInfo));
#include "du_app_mac_inf.h"
#include "rg.x" /* typedefs for MAC */
-#include "mac_sch_interface.h"
#include "mac_upr_inf_api.h"
+#include "mac.h"
/* local externs */
#ifdef UNUSED_FUNC
} /* rgLIMTfuDatReq*/
#endif /*L2_OPTMZ */
+void fapiMacConfigRsp()
+{
+ /* TODO : Processing of conig response from PHY */
+
+ /* Send cell config cfm to DU APP */
+ MacSendCellCfgCfm(RSP_OK);
+}
+
/**
* @brief Transmission time interval indication from PHY.
*
return RFAILED;
}
+ slotInfo->cellId = macCb.macCell->cellId;
+ slotInfo->sfn = slotInd->sfn;
+ slotInfo->slot = slotInd->slot;
+
/* Fill Pst */
pst.selector = DU_MAC_LWLC;
pst.srcEnt = ENTRG;
pst.dstEnt = ENTDUAPP;
pst.dstInst = 0;
- pst.srcInst = 0;
+ pst.srcInst = macCb.macInst;
pst.dstProcId = rgCb[pst.srcInst].rgInit.procId;
pst.srcProcId = rgCb[pst.srcInst].rgInit.procId;
pst.region = MAC_MEM_REGION;
/* Public variable declaration */
ClCb clGlobalCp;
+MacCb macCb;
/* forward references */
PRIVATE U16 rgLMMGenCfg ARGS((
rgCb[inst].rgInit.region = cfg->s.genCfg.mem.region;
rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool;
rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes;
+
+ macCb.macInst = rgCb[inst].rgInit.inst;
+
/* Initialize SAP States */
rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
return RFAILED;
}
macCb.macCell = macCellCb;
+ macCb.macCell->cellId = macCellCfg->cellId;
/* Send cell cfg to scheduler */
ret = MacSchCellCfgReq(pst, macCellCfg);
if(ret != ROK)
return ret;
} /* end of MacSchCellCfgReq */
+
+/*******************************************************************
+ *
+ * @brief Sends Cell config confirm to DU APP
+ *
+ * @details
+ *
+ * Function : MacSendCellCfgCfm
+ *
+ * Functionality:
+ * Sends Cell config confirm to DU APP
+ *
+ * @params[in] Response status
+ * @return void
+ *
+ * ****************************************************************/
+void MacSendCellCfgCfm(uint8_t response)
+{
+ Pst pst;
+ RgCellCb *cellCb;
+ MacCellCfgCfm macCellCfgCfm;
+
+ cmMemset((U8 *)&pst, 0, sizeof(Pst));
+ cellCb = rgCb[macCb.macInst].cell;
+
+ macCellCfgCfm.transId = cellCb->macCellCfg.transId;
+ macCellCfgCfm.rsp = response;
+
+ memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
+ pst.event = EVENT_MAC_CELL_CONFIG_CFM;
+ (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
+}
+
+
/**
* @brief Layer Manager Configuration response handler.
*
SchCellCfgCfm *schCellCfgCfm
)
{
- Pst cfmPst;
- int ret;
- RgCellCb *cellCb;
- MacCellCfgCfm macCellCfgCfm;
-
- cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
- cellCb = rgCb[pst->dstInst].cell;
- macCellCfgCfm.transId = cellCb->macCellCfg.transId;
if(schCellCfgCfm->rsp == RSP_OK)
{
- macCellCfgCfm.rsp = RSP_OK;
+ sendToLowerMac(PARAM_REQUEST, 0, (void *)NULL);
}
else
{
- macCellCfgCfm.rsp = RSP_NOK;
+ MacSendCellCfgCfm(RSP_NOK);
}
- macCellCfgFillCfmPst(pst,&cfmPst);
- ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
-
+ return ROK;
}
+
/**********************************************************************
End of file
typedef struct slotInfo
{
+ uint16_t cellId;
uint16_t sfn;
uint16_t slot;
}SlotInfo;
{
U32 cellId; /* Internal cell Id */
CellCfgParams cellInfo; /* Cell info */
+ Bool firstSlotIndRcvd;
CellStatus cellStatus; /*Cell status */
}DuCellCb;
/* TODO: Trigger cell start req once cell up slot ind is received*/
/* Build and Send Cell Start Req to MAC */
- //ret = duBuildAndSendMacCellStartReq();
+ ret = duBuildAndSendMacCellStartReq();
}
else
DU_LOG("\nDU APP : Slot Indication received");
+ if(slotInfo->cellId <=0 || slotInfo->cellId > DU_MAX_CELLS)
+ {
+ DU_LOG("\nDU APP : Invalid Cell Id %d", slotInfo->cellId);
+ }
+ if(!duCb.actvCellLst[slotInfo->cellId-1]->firstSlotIndRcvd)
+ {
+ duCb.actvCellLst[slotInfo->cellId-1]->firstSlotIndRcvd = true;
+ if((duCb.actvCellLst[slotInfo->cellId-1] != NULL) && \
+ (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \
+ ACTIVATION_IN_PROGRESS))
+ {
+ DU_LOG("\nDU APP : Cell Id %d is ACTIVE", slotInfo->cellId);
+ duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED;
+ }
+
+ }
+
/* TODO : Slot Indication to be moved out of EGTP_TEST when
* data path is established */
#ifdef EGTP_TEST
{
if(duCb.actvCellLst[id])
{
+ duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE;
cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId;
/* Fill Pst */
{
if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
{
- clGlobalCp.phyState = PHY_STATE_RUNNING;
duStartSlotIndicaion();
#ifdef FAPI
SPutSBuf(0, 0, (Data *)msg, sizeof(fapi_start_req_t));