From 694d8fa8539d4b69710b61d01d5a0535bb98716e Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Fri, 17 Apr 2020 21:22:23 +0530 Subject: [PATCH] sib1Changes in DL TTI Change-Id: I4bc6321ab4a9d42f449a1d61fa568737562e5526 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac_fsm.c | 318 +++++++++++++++++++++++++++++++++++++++------ src/5gnrmac/mac.h | 2 +- src/5gnrmac/mac_slot_ind.c | 4 +- src/5gnrsch/sch.c | 6 +- src/5gnrsch/sch.h | 3 +- src/5gnrsch/sch_common.c | 4 +- src/5gnrsch/sch_slot_ind.c | 14 +- src/5gnrsch/sch_utils.c | 2 +- src/cm/envopt.h | 4 +- src/cm/lphy_stub.h | 2 +- src/cm/mac_sch_interface.h | 6 +- src/du_app/du_cfg.h | 4 +- src/phy_stub/l1_bdy1.c | 34 ++++- src/phy_stub/l1_bdy2.c | 2 +- 14 files changed, 339 insertions(+), 66 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index d42b5c40c..6cb0a211f 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -63,6 +63,8 @@ #include "rg.x" /* typedefs for MAC */ #define MIB_SFN_BITMASK 0xFC +#define PDCCH_PDU_TYPE 0 +#define PDSCH_PDU_TYPE 1 #define SSB_PDU_TYPE 3 #define SETLENGTH(x, size) x += size @@ -1247,9 +1249,9 @@ PUBLIC void fillRssiMeas(uint8_t value, ClCellParam **cellPtr) uint32_t getParamValue(fapi_uint16_tlv_t *tlv, uint16_t type) { - uint16_t valueLen; + //uint16_t valueLen; void *posPtr; - valueLen = tlv->tl.length; + //valueLen = tlv->tl.length; posPtr = &tlv->tl.tag; posPtr += sizeof(tlv->tl.tag); posPtr += sizeof(tlv->tl.length); @@ -2081,7 +2083,8 @@ PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val) ******************************************************************/ S16 fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg, -uint32_t *msgLen) + MacDlSlot *currDlSlot, + uint32_t *msgLen, uint8_t ssbIdxCount) { uint32_t mibPayload = 0; if(dlTtiReqPdu != NULL) @@ -2089,7 +2092,7 @@ uint32_t *msgLen) dlTtiReqPdu->pduType = SSB_PDU_TYPE; /* SSB PDU */ dlTtiReqPdu->u.ssb_pdu.physCellId = macCellCfg->phyCellId; dlTtiReqPdu->u.ssb_pdu.betaPss = macCellCfg->ssbCfg.betaPss; - dlTtiReqPdu->u.ssb_pdu.ssbBlockIndex = macCb.macCell->dlSlot[0].cellBroadcastInfo.ssbIdxSupported; + dlTtiReqPdu->u.ssb_pdu.ssbBlockIndex = currDlSlot->cellBroadcastInfo.ssbInfo[ssbIdxCount].ssbIdx; dlTtiReqPdu->u.ssb_pdu.ssbSubCarrierOffset = macCellCfg->ssbCfg.ssbScOffset; /* ssbOfPdufstA to be filled in ssbCfg */ dlTtiReqPdu->u.ssb_pdu.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA; @@ -2112,7 +2115,206 @@ uint32_t *msgLen) return RFAILED; } } + +/******************************************************************* + * + * @brief fills Dl DCI PDU required for DL TTI info in MAC + * + * @details + * + * Function : fillDlDciPdu + * + * Functionality: + * -Fills the Dl DCI PDU + * + * @params[in] Pointer to fapi_dl_dci_t + * Pointer to Sib1PdcchCfg + * @return ROK + * + ******************************************************************/ + +void fillDlDciPdu(fapi_dl_dci_t *dlDciPtr, Sib1PdcchCfg *sib1PdcchInfo) +{ + if(dlDciPtr != NULLP) + { + dlDciPtr->rnti = sib1PdcchInfo->sib1DlDci.rnti; + dlDciPtr->scramblingId = sib1PdcchInfo->sib1DlDci.scramblingId; + dlDciPtr->scramblingRnti = sib1PdcchInfo->sib1DlDci.scramblingRnti; + dlDciPtr->cceIndex = sib1PdcchInfo->sib1DlDci.cceIndex; + dlDciPtr->aggregationLevel = sib1PdcchInfo->sib1DlDci.aggregLevel; + dlDciPtr->pc_and_bform.numPrgs = sib1PdcchInfo->sib1DlDci.beamPdcchInfo.numPrgs; + dlDciPtr->pc_and_bform.prgSize = sib1PdcchInfo->sib1DlDci.beamPdcchInfo.prgSize; + dlDciPtr->pc_and_bform.digBfInterfaces = sib1PdcchInfo->sib1DlDci.beamPdcchInfo.digBfInterfaces; + dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = sib1PdcchInfo->sib1DlDci.beamPdcchInfo.prg[0].pmIdx; + dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = sib1PdcchInfo->sib1DlDci.beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr->beta_pdcch_1_0 = sib1PdcchInfo->sib1DlDci.txPdcchPower.powerValue; + dlDciPtr->powerControlOfssetSS = sib1PdcchInfo->sib1DlDci.txPdcchPower.powerControlOffsetSS; + //dlDciPtr->payloadSizeBits; + //dlDciPtr->payload[DCI_PAYLOAD_BYTE_LEN]; + } +} + +/******************************************************************* + * + * @brief fills PDCCH PDU required for DL TTI info in MAC + * + * @details + * + * Function : fillPdcchPdu + * + * Functionality: + * -Fills the Pdcch PDU info + * stored in MAC + * + * @params[in] Pointer to FAPI DL TTI Req + * Pointer to Sib1PdcchCfg + * Pointer to msgLen of DL TTI Info + * @return ROK + * + ******************************************************************/ + +S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, Sib1PdcchCfg *sib1PdcchInfo, +uint32_t *msgLen) +{ + if(dlTtiReqPdu != NULLP) + { + dlTtiReqPdu->pduType = PDCCH_PDU_TYPE; + dlTtiReqPdu->u.pdcch_pdu.bwpSize = sib1PdcchInfo->sib1PdcchBwpCfg.BWPSize; + dlTtiReqPdu->u.pdcch_pdu.bwpPart = sib1PdcchInfo->sib1PdcchBwpCfg.BWPStart; + dlTtiReqPdu->u.pdcch_pdu.subCarrierSpacing = sib1PdcchInfo->sib1PdcchBwpCfg.subcarrierSpacing; + dlTtiReqPdu->u.pdcch_pdu.cyclicPrefix = sib1PdcchInfo->sib1PdcchBwpCfg.cyclicPrefix; + dlTtiReqPdu->u.pdcch_pdu.startSymbolIndex = sib1PdcchInfo->sib1Coreset0Cfg.startSymbolIndex; + dlTtiReqPdu->u.pdcch_pdu.durationSymbols = sib1PdcchInfo->sib1Coreset0Cfg.durationSymbols; + memcpy(dlTtiReqPdu->u.pdcch_pdu.freqDomainResource, sib1PdcchInfo->sib1Coreset0Cfg.freqDomainResource, 6); + dlTtiReqPdu->u.pdcch_pdu.cceRegMappingType = sib1PdcchInfo->sib1Coreset0Cfg.cceRegMappingType; + dlTtiReqPdu->u.pdcch_pdu.regBundleSize = sib1PdcchInfo->sib1Coreset0Cfg.regBundleSize; + dlTtiReqPdu->u.pdcch_pdu.interleaverSize = sib1PdcchInfo->sib1Coreset0Cfg.interleaverSize; + dlTtiReqPdu->u.pdcch_pdu.coreSetSize = sib1PdcchInfo->sib1Coreset0Cfg.coreSetType; + dlTtiReqPdu->u.pdcch_pdu.shiftIndex = sib1PdcchInfo->sib1Coreset0Cfg.shiftIndex; + dlTtiReqPdu->u.pdcch_pdu.precoderGranularity = sib1PdcchInfo->sib1Coreset0Cfg.precoderGranularity; + dlTtiReqPdu->u.pdcch_pdu.numDlDci = sib1PdcchInfo->numDlDci; + MAC_ALLOC(dlTtiReqPdu->u.pdcch_pdu.dlDci, sizeof(fapi_dl_dci_t)); + fillDlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, sib1PdcchInfo); + dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t); + SETLENGTH(*msgLen, sizeof(fapi_dl_pdcch_pdu_t)); + + } + return ROK; + +} + +/******************************************************************* + * + * @brief fills PDSCH PDU required for DL TTI info in MAC + * + * @details + * + * Function : fillPdschPdu + * + * Functionality: + * -Fills the Pdsch PDU info + * stored in MAC + * + * @params[in] Pointer to FAPI DL TTI Req + * Pointer to Sib1PdschCfg + * Pointer to msgLen of DL TTI Info + * @return ROK + * + ******************************************************************/ + +void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, Sib1PdschCfg *sib1PdschInfo, +uint32_t *msgLen) +{ + uint8_t idx; + + if(dlTtiReqPdu != NULLP) + { + dlTtiReqPdu->pduType = PDSCH_PDU_TYPE; + dlTtiReqPdu->u.pdsch_pdu.pduBitMap = sib1PdschInfo->pduBitmap; + dlTtiReqPdu->u.pdsch_pdu.rnti = sib1PdschInfo->rnti; + dlTtiReqPdu->u.pdsch_pdu.pduIndex = sib1PdschInfo->pduIndex; + dlTtiReqPdu->u.pdsch_pdu.bwpSize = sib1PdschInfo->sib1PdschBwpCfg.BWPSize; + dlTtiReqPdu->u.pdsch_pdu.bwpStart = sib1PdschInfo->sib1PdschBwpCfg.BWPStart; + dlTtiReqPdu->u.pdsch_pdu.subCarrierSpacing = sib1PdschInfo->sib1PdschBwpCfg.subcarrierSpacing; + dlTtiReqPdu->u.pdsch_pdu.cyclicPrefix = sib1PdschInfo->sib1PdschBwpCfg.cyclicPrefix; + dlTtiReqPdu->u.pdsch_pdu.nrOfCodeWords = sib1PdschInfo->numCodewords; + for(idx = 0; idx < MAX_CODEWORDS ; idx++) + { + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].targetCodeRate = sib1PdschInfo->codeword[idx].targetCodeRate; + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].qamModOrder = sib1PdschInfo->codeword[idx].qamModOrder; + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].mcsIndex = sib1PdschInfo->codeword[idx].mcsIndex; + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].mcsTable = sib1PdschInfo->codeword[idx].mcsTable; + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].rvIndex = sib1PdschInfo->codeword[idx].rvIndex; + dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].tbSize = sib1PdschInfo->codeword[idx].tbSize; + } + dlTtiReqPdu->u.pdsch_pdu.dataScramblingId = sib1PdschInfo->dataScramblingId; + dlTtiReqPdu->u.pdsch_pdu.nrOfLayers = sib1PdschInfo->numLayers; + dlTtiReqPdu->u.pdsch_pdu.transmissionScheme = sib1PdschInfo->transmissionScheme; + dlTtiReqPdu->u.pdsch_pdu.refPoint = sib1PdschInfo->refPoint; + dlTtiReqPdu->u.pdsch_pdu.dlDmrsSymbPos = sib1PdschInfo->dmrs.dlDmrsSymbPos; + dlTtiReqPdu->u.pdsch_pdu.dmrsConfigType = sib1PdschInfo->dmrs.dmrsConfigType; + dlTtiReqPdu->u.pdsch_pdu.dlDmrsScramblingId = sib1PdschInfo->dmrs.dlDmrsScramblingId; + dlTtiReqPdu->u.pdsch_pdu.scid = sib1PdschInfo->dmrs.scid; + dlTtiReqPdu->u.pdsch_pdu.numDmrsCdmGrpsNoData = sib1PdschInfo->dmrs.numDmrsCdmGrpsNoData; + dlTtiReqPdu->u.pdsch_pdu.dmrsPorts = sib1PdschInfo->dmrs.dmrsPorts; + dlTtiReqPdu->u.pdsch_pdu.resourceAlloc = sib1PdschInfo->sib1FreqAlloc.resourceAlloc; + /* since we are using type-1, hence rbBitmap excluded */ + dlTtiReqPdu->u.pdsch_pdu.rbStart = sib1PdschInfo->sib1FreqAlloc.rbStart; + dlTtiReqPdu->u.pdsch_pdu.rbSize = sib1PdschInfo->sib1FreqAlloc.rbSize; + dlTtiReqPdu->u.pdsch_pdu.vrbToPrbMapping = sib1PdschInfo->sib1FreqAlloc.vrbPrbMapping; + dlTtiReqPdu->u.pdsch_pdu.startSymbIndex = sib1PdschInfo->sib1TimeAlloc.startSymbolIndex; + dlTtiReqPdu->u.pdsch_pdu.nrOfSymbols = sib1PdschInfo->sib1TimeAlloc.numSymbols; + dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.numPrgs = sib1PdschInfo->beamPdschInfo.numPrgs; + dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.prgSize = sib1PdschInfo->beamPdschInfo.prgSize; + dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = sib1PdschInfo->beamPdschInfo.digBfInterfaces; + dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ + pmIdx = sib1PdschInfo->beamPdschInfo.prg[0].pmIdx; + dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ + beamIdx[0].beamidx = sib1PdschInfo->beamPdschInfo.prg[0].beamIdx[0]; + dlTtiReqPdu->u.pdsch_pdu.powerControlOffset = sib1PdschInfo->txPdschPower.powerControlOffset; + dlTtiReqPdu->u.pdsch_pdu.powerControlOffsetSS = sib1PdschInfo->txPdschPower.powerControlOffsetSS; + dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t); + SETLENGTH(*msgLen, sizeof(fapi_dl_pdsch_pdu_t)); + + } + +} + +/*********************************************************************** + * + * @brief calculates the total size to be allocated for DL TTI Req + * + * @details + * + * Function : calculatePduCount + * + * Functionality: + * -calculates the total pdu count to be allocated for DL TTI Req + * + * @params[in] DlBrdcstAlloc *cellBroadcastInfo + * @return count + * + * ********************************************************************/ +uint8_t calculatePduCount(DlBrdcstAlloc *cellBroadcastInfo) +{ + uint8_t count = 0; + uint8_t idx = 0; + if(cellBroadcastInfo->ssbTrans) + { + for(idx = 0; idx < cellBroadcastInfo->ssbIdxSupported; idx++) + { + count++; + } + } + if(cellBroadcastInfo->sib1Trans) + { + count += 2; + } + return count; +} + #endif + /******************************************************************* * * @brief Sends DL TTI Request to PHY @@ -2132,53 +2334,93 @@ uint32_t *msgLen) S16 handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo) { #ifdef FAPI - uint32_t msgLen; - fapi_dl_tti_req_t *dlTtiReq; - fapi_dl_tti_req_pdu_t *dlTtiReqPdu; - RgCellCb *cellCbParams; + uint8_t idx; + uint32_t msgLen = 0; + fapi_dl_tti_req_t *dlTtiReq = NULLP; + fapi_dl_tti_req_pdu_t *dlTtiReqPdu = NULLP; + RgCellCb *cellCbParams = NULLP; + MacDlSlot *currDlSlot = NULLP; MacCellCfg macCellCfg; + cmMemset((U8 *)&macCellCfg, 0, sizeof(MacCellCfg)); Inst inst = 0; - cellCbParams = rgCb[inst].cell; - if(dlTtiReqtimingInfo != NULLP) + if(clGlobalCp.phyState == PHY_STATE_RUNNING) { - MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t)); - if(dlTtiReq != NULLP) + cellCbParams = rgCb[inst].cell; + macCellCfg = cellCbParams->macCellCfg; + + if(dlTtiReqtimingInfo != NULLP) { - /* fill the SFN and slot value from crntTime */ - dlTtiReq->sfn = dlTtiReqtimingInfo->sfn; - dlTtiReq->slot = dlTtiReqtimingInfo->slot; - dlTtiReq->nPdus = 0; - dlTtiReq->nGroup = 0; - if(macCb.macCell->dlSlot[0].cellBroadcastInfo.ssbTrans) + MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t)); + if(dlTtiReq != NULLP) { - macCellCfg = cellCbParams->macCellCfg; - - MAC_ALLOC(dlTtiReqPdu, sizeof(fapi_dl_tti_req_pdu_t)); - if(dlTtiReqPdu != NULLP) + dlTtiReq->sfn = dlTtiReqtimingInfo->sfn; + dlTtiReq->slot = dlTtiReqtimingInfo->slot; + currDlSlot = &macCb.macCell->dlSlot[dlTtiReq->slot % MAX_SLOT_SUPPORTED]; + dlTtiReq->nPdus = calculatePduCount(&currDlSlot->cellBroadcastInfo); /* get total Pdus */ + dlTtiReq->nGroup = 0; + if(dlTtiReq->nPdus > 0) { - fillSsbPdu(dlTtiReqPdu, &macCellCfg, &msgLen); - dlTtiReq->pdus = dlTtiReqPdu; - } - (dlTtiReq->nPdus)++; - msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); - fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); - sendToPhy(dlTtiReq->header.message_type_id, msgLen, (void *)dlTtiReq); - MAC_FREE(dlTtiReqPdu, sizeof(fapi_dl_tti_req_pdu_t)); + MAC_ALLOC(dlTtiReqPdu, (dlTtiReq->nPdus * sizeof(fapi_dl_tti_req_pdu_t))); + if(currDlSlot->cellBroadcastInfo.ssbTrans) + { + if(dlTtiReqPdu != NULLP) + { + for(idx = 0; idx < currDlSlot->cellBroadcastInfo.ssbIdxSupported; idx++) + { + if(idx > 0) + dlTtiReq->pdus++; + fillSsbPdu(dlTtiReqPdu, &macCellCfg, currDlSlot, &msgLen, idx); + dlTtiReq->pdus = dlTtiReqPdu; + } + } + } + if(currDlSlot->cellBroadcastInfo.sib1Trans) + { + /* Filling SIB1 param */ + if(dlTtiReqPdu != NULLP) + { + dlTtiReq->pdus++; + fillPdcchPdu(dlTtiReqPdu, &currDlSlot->cellBroadcastInfo.sib1Alloc.sib1PdcchCfg, &msgLen); + dlTtiReq->pdus = dlTtiReqPdu; + dlTtiReq->pdus++; + fillPdschPdu(dlTtiReqPdu, &currDlSlot->cellBroadcastInfo.sib1Alloc.sib1PdschCfg, &msgLen); + dlTtiReq->pdus = dlTtiReqPdu; + } + } + msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); + fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); + sendToPhy(dlTtiReq->header.message_type_id, msgLen, (void *)dlTtiReq); + if(currDlSlot->cellBroadcastInfo.sib1Trans) + { + MAC_FREE(dlTtiReq->pdus->u.pdcch_pdu.dlDci, sizeof(fapi_dl_dci_t)); + } + MAC_FREE(dlTtiReqPdu, (dlTtiReq->nPdus * sizeof(fapi_dl_tti_req_pdu_t))); + } + else + { + msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); + fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); + sendToPhy(dlTtiReq->header.message_type_id, msgLen, (void *)dlTtiReq); + } + MAC_FREE(dlTtiReq, sizeof(fapi_dl_tti_req_t)); + return ROK; + } + else + { + DU_LOG("\nLOWER MAC: Failed to allocate memory for DL TTI Request"); + return RFAILED; } - MAC_FREE(dlTtiReq, sizeof(fapi_dl_tti_req_t)); - return ROK; } - else + else { - DU_LOG("\nLOWER MAC: Failed to allocate memory for DL TTI Request"); + DU_LOG("\nLOWER MAC: Current TTI Info is NULL"); return RFAILED; } } - else - { - DU_LOG("\nLOWER MAC: Current TTI Info is NULL"); - return RFAILED; + else + { + lwr_mac_handleInvalidEvt(dlTtiReqtimingInfo); } #else return ROK; diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index f6b483fbf..f2b60ed74 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -48,7 +48,7 @@ #include "tfu.x" /* RGU Interface includes */ #include "lrg.x" -#define MAX_SLOT_SUPPORTED 50 +#define MAX_SLOT_SUPPORTED 10 /* numerology 0 15Khz */ typedef struct macDlSlot { diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index cba1ccc20..a2602b564 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -46,7 +46,9 @@ int MacProcDlBrdcstAlloc(Pst *pst, DlBrdcstAlloc *dlBrdcstAlloc) { if(dlBrdcstAlloc != NULLP) { - memcpy(&macCb.macCell->dlSlot[0].cellBroadcastInfo, dlBrdcstAlloc, sizeof(DlBrdcstAlloc)); + MacDlSlot *currDlSlot = + &macCb.macCell->dlSlot[dlBrdcstAlloc->slotIndInfo.slot % MAX_SLOT_SUPPORTED]; + memcpy(&currDlSlot->cellBroadcastInfo, dlBrdcstAlloc, sizeof(DlBrdcstAlloc)); } return ROK; } diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index ebeb19516..afd3bc2cb 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -421,13 +421,13 @@ uint8_t offsetPointA sib1SchCfg->n0 = slotIndex; /* calculate the PRBs */ - freqDomResourceAlloc((offsetPointA-offset),numRbs,FreqDomainResource); + freqDomResourceAlloc( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); /* fill the PDCCH PDU */ pdcch->sib1PdcchBwpCfg.BWPSize = MAX_NUM_RB; /* whole of BW */ pdcch->sib1PdcchBwpCfg.BWPStart = 0; - pdcch->subcarrierSpacing = 0; /* 15Khz */ - pdcch->cyclicPrefix = 0; /* normal */ + pdcch->sib1PdcchBwpCfg.subcarrierSpacing = 0; /* 15Khz */ + pdcch->sib1PdcchBwpCfg.cyclicPrefix = 0; /* normal */ pdcch->sib1Coreset0Cfg.startSymbolIndex = firstSymbol; pdcch->sib1Coreset0Cfg.durationSymbols = numSymbols; memcpy(pdcch->sib1Coreset0Cfg.freqDomainResource,FreqDomainResource,6); diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 2d1220eba..906e436b6 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -25,12 +25,13 @@ #define SCH_MIB_TRANS 80 #define SCH_NUM_SC_PRB 12 /* number of SCs in a PRB */ #define SCH_MAX_SSB_BEAM 4 /* since we are supporting only SCS=15KHz */ -#define SCH_SCS_15KHZ 15 +#define SCH_SCS_15KHZ 0 /* numerology 0 and 15Khz */ #define SCH_SYMBOL_PER_SLOT 14 #define SCH_SSB_SYMB_DURATION 4 #define SCH_SSB_PRB_DURATION 20 #define SCH_MEM_REGION 4 #define SCH_POOL 1 +#define SCHED_DELTA 1 /* allocate and zero out a static buffer */ #define SCH_ALLOC(_datPtr, _size) \ diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 8907fe978..5d79f162d 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -124,7 +124,7 @@ uint8_t schCmnDlAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc) { scs = cell->cellCfg.ssbSchCfg.scsCommon; ssbStartPrb = \ - ((cell->cellCfg.ssbSchCfg.ssbSubcOffset)-(cell->cellCfg.ssbSchCfg.ssbOffsetPointA))/SCH_NUM_SC_PRB; + (cell->cellCfg.ssbSchCfg.ssbOffsetPointA)/SCH_NUM_SC_PRB; memset(ssbStartSymbArr, 0, SCH_MAX_SSB_BEAM); ssbDlTdAlloc(scs, ssbStartSymbArr); @@ -146,7 +146,7 @@ uint8_t schCmnDlAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc) dlAlloc->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported; for(idx=ssbStartSymb; idxassignedPrb[idx] = SCH_SSB_PRB_DURATION; + dlAlloc->assignedPrb[idx] = SCH_SSB_PRB_DURATION + 1; /* +1 for kSsb */ } } diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 47346c3bd..130ed2b1f 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -118,6 +118,9 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) { int ret = ROK; uint8_t ssb_rep; + uint16_t sfn = slotInd->sfn; + uint16_t slot = slotInd->slot; + uint16_t sfnSlot = 0; DlBrdcstAlloc dlBrdcstAlloc; dlBrdcstAlloc.ssbTrans = NO_SSB; dlBrdcstAlloc.sib1Trans = NO_SIB1; @@ -130,11 +133,18 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) cell = schCb[schInst].cells[schInst]; ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); - memcpy(&dlBrdcstAlloc.slotIndInfo, slotInd, sizeof(SlotIndInfo)); dlBrdcstAlloc.cellId = cell->cellId; dlBrdcstAlloc.ssbIdxSupported = 1; - uint16_t sfnSlot = (slotInd->sfn * 10) + slotInd->slot; + if((slot + SCHED_DELTA) >= 10) + { + sfn++; + } + slot = ((slot + SCHED_DELTA) % 10 ); + sfnSlot = ((sfn * 10) + slot); + + dlBrdcstAlloc.slotIndInfo.sfn = sfn; + dlBrdcstAlloc.slotIndInfo.slot = slot; /* Identify SSB ocassion*/ if (sfnSlot % SCH_MIB_TRANS == 0) diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index a6232435d..6494033e2 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -93,7 +93,7 @@ int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4] = { **/ void freqDomResourceAlloc(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain) { - uint8_t remBits = prbSize/6; /* each bit represents 6 PRBs */ + uint8_t remBits = prbSize; /* each bit represents 6 PRBs */ uint8_t firstByte = 1; uint8_t numBits,startBit,byteCount = 0; diff --git a/src/cm/envopt.h b/src/cm/envopt.h index 4c0558167..42995737e 100755 --- a/src/cm/envopt.h +++ b/src/cm/envopt.h @@ -801,9 +801,9 @@ #endif #if defined(DLHQ_RTT_OPT) && defined(LOWLATENCY) -#define TFU_DELTA 2 +#define TFU_DELTA 0 #else -#define TFU_DELTA 2 +#define TFU_DELTA 0 #endif #define TFU_RECPREQ_DLDELTA 2 diff --git a/src/cm/lphy_stub.h b/src/cm/lphy_stub.h index 7ef881bcf..a6818dd93 100644 --- a/src/cm/lphy_stub.h +++ b/src/cm/lphy_stub.h @@ -10,5 +10,5 @@ #include "ssi.x" /* System services */ void duStartSlotIndicaion(); -void buildAndSendSlotIndication(); +S16 buildAndSendSlotIndication(); S16 duSendEgtpSlotInd(); diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index cb403cad5..decd330dc 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -61,6 +61,8 @@ typedef struct /* SIB1 interface structure */ typedef struct bwpCfg { + uint8_t subcarrierSpacing; + uint8_t cyclicPrefix; uint16_t BWPSize; uint16_t BWPStart; }BwpCfg; @@ -114,10 +116,6 @@ typedef struct dlDCI typedef struct sib1PdcchCfg { BwpCfg sib1PdcchBwpCfg; - - uint8_t subcarrierSpacing; - uint8_t cyclicPrefix; - /* coreset-0 configuration */ CoresetCfg sib1Coreset0Cfg; diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 9e8b12404..d14b17b6a 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -60,11 +60,11 @@ #define FREQ_SHIFT_7P5KHZ FALSE #define SSB_PBCH_PWR -5 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD -#define SUBCARRIER_SPACING 1 +#define SUBCARRIER_SPACING 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 SSB_PERIODICITY 2 +#define SSB_PERIODICITY 5 #define SSB_SUBCARRIER_OFFSET 0 #define SSB_MULT_CARRIER_BAND FALSE #define MULT_CELL_CARRIER FALSE diff --git a/src/phy_stub/l1_bdy1.c b/src/phy_stub/l1_bdy1.c index 64c5a043f..3d137f81c 100644 --- a/src/phy_stub/l1_bdy1.c +++ b/src/phy_stub/l1_bdy1.c @@ -174,7 +174,7 @@ S16 l1BldAndSndConfigRsp(void *msg) #ifdef FAPI uint8_t index = 0; uint32_t msgLen = 0; - fapi_config_resp_t *fapiConfigRsp = (fapi_config_resp_t *)msg; + fapi_config_resp_t *fapiConfigRsp = (fapi_config_resp_t *)msg; if(fapiConfigRsp != NULL) { @@ -266,7 +266,7 @@ PUBLIC void l1HdlConfigReq(uint32_t msgLen, void *msg) * @return void * * ****************************************************************/ -PUBLIC void buildAndSendSlotIndication() +PUBLIC S16 buildAndSendSlotIndication() { #ifdef FAPI fapi_slot_ind_t *slotIndMsg; @@ -278,12 +278,12 @@ PUBLIC void buildAndSendSlotIndication() else { slotValue++; - if(sfnValue >= MAX_SFN_VALUE && slotValue >= MAX_SLOT_VALUE) + if(sfnValue > MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE) { sfnValue = 0; slotValue = 0; } - else if(slotValue >= MAX_SLOT_VALUE) + else if(slotValue > MAX_SLOT_VALUE) { sfnValue++; slotValue = 0; @@ -291,11 +291,12 @@ PUBLIC void buildAndSendSlotIndication() slotIndMsg->sfn = sfnValue; slotIndMsg->slot = slotValue; fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, sizeof(fapi_slot_ind_t)); - printf("\nPHY_STUB: Sending Slot Indication Msg to Lower Mac"); + printf("\nPHY_STUB [%d:%d] ",sfnValue,slotValue); handlePhyMessages((void*)slotIndMsg); SPutSBuf(0, 0, (Data *)slotIndMsg, sizeof(slotIndMsg)); } #endif + return ROK; } /******************************************************************* @@ -316,10 +317,11 @@ PUBLIC void buildAndSendSlotIndication() * * ****************************************************************/ -PUBLIC void l1HdlStartReq(uint32_t msgLen, void *msg) +PUBLIC S16 l1HdlStartReq(uint32_t msgLen, void *msg) { if(clGlobalCp.phyState == PHY_STATE_CONFIGURED) { + clGlobalCp.phyState = PHY_STATE_RUNNING; duStartSlotIndicaion(); #ifdef FAPI SPutSBuf(0, 0, (Data *)msg, sizeof(fapi_start_req_t)); @@ -351,11 +353,12 @@ PUBLIC void l1HdlStartReq(uint32_t msgLen, void *msg) * * ****************************************************************/ -PUBLIC void l1HdlDlTtiReq(uint16_t msgLen, void *msg) +PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg) { #ifdef FAPI fapi_dl_tti_req_t *dlTtiReq; dlTtiReq = (fapi_dl_tti_req_t *)msg; +#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); @@ -369,6 +372,23 @@ PUBLIC void l1HdlDlTtiReq(uint16_t msgLen, void *msg) printf("\nPHY_STUB: ssbOffsetPointA %d", dlTtiReq->pdus->u.ssb_pdu.ssbOffsetPointA); printf("\nPHY_STUB: bchPayloadFlag %d", dlTtiReq->pdus->u.ssb_pdu.bchPayloadFlag); printf("\nPHY_STUB: bchPayload %x", dlTtiReq->pdus->u.ssb_pdu.bchPayload); +#endif + uint8_t numPdus = dlTtiReq->nPdus; + if(numPdus == 0) + { + printf("no PDU \n"); + } + while(numPdus) + { + if(dlTtiReq->pdus->pduType == 3) //SSB_PDU_TYPE + printf("SSB PDU\n"); + else if(dlTtiReq->pdus->pduType == 0) + printf("SIB1 PDCCH PDU\n"); + else if(dlTtiReq->pdus->pduType == 1) + printf("SIB1 PDSCH PDU\n"); + + numPdus--; + } SPutSBuf(0, 0, (Data *)dlTtiReq, sizeof(fapi_dl_tti_req_t)); #endif diff --git a/src/phy_stub/l1_bdy2.c b/src/phy_stub/l1_bdy2.c index 523936af4..43a786469 100644 --- a/src/phy_stub/l1_bdy2.c +++ b/src/phy_stub/l1_bdy2.c @@ -25,7 +25,7 @@ void *GenerateTicks(void *arg) { - uint8_t counter = 2; + uint8_t counter = 100; while(counter) { sleep(1); -- 2.16.6