From eb178a8cc45a9cebc65df73f128f88b3a3dfefbb Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Wed, 15 Jul 2020 18:00:31 +0530 Subject: [PATCH 1/1] fix ODUHIGH-182 updating code to be compatible with latest available fapi_inetrface file Change-Id: Icfdb1acda05e1f00e721fbaec5bcfadae88bf8d2 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac_fsm.c | 574 +++++++++++++++++---------------------- src/5gnrmac/lwr_mac_fsm.h | 6 + src/5gnrmac/lwr_mac_handle_phy.c | 6 +- src/5gnrsch/sch.c | 4 + src/5gnrsch/sch.h | 3 + src/5gnrsch/sch_common.c | 3 + src/5gnrsch/sch_rach.c | 6 + src/5gnrsch/sch_utils.c | 11 +- src/cm/mac_sch_interface.h | 6 + src/du_app/du_cell_mgr.c | 6 +- src/du_app/du_cell_mgr.h | 1 + src/du_app/du_f1ap_msg_hdl.c | 2 +- src/phy_stub/l1_bdy1.c | 52 ++-- 13 files changed, 329 insertions(+), 351 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index be8a4b1f8..941d8b34b 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -117,7 +117,8 @@ S16 lwr_mac_handleInvalidEvt(void *msg) * ****************************************************************/ PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen) { - hdr->message_type_id = msgType; + memset(hdr, 0, sizeof(fapi_msg_t)); + hdr->msg_id = msgType; hdr->length = msgLen; } @@ -140,7 +141,7 @@ PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen) * @return void * * ****************************************************************/ -PUBLIC void fillTlvs(fapi_uint16_tlv_t *tlv, uint16_t tag, uint16_t length, +PUBLIC void fillTlvs(fapi_uint32_tlv_t *tlv, uint16_t tag, uint16_t length, uint16_t value, uint32_t *msgLen) { tlv->tl.tag = tag; @@ -1309,7 +1310,7 @@ S16 lwr_mac_handleParamReqEvt(void *msg) fillMsgHeader(¶mReq->header, FAPI_PARAM_REQUEST, msgLen); DU_LOG("\nLWR_MAC: Sending Param Request to Phy"); - LwrMacSendToPhy(paramReq->header.message_type_id, \ + LwrMacSendToPhy(paramReq->header.msg_id, \ sizeof(fapi_param_req_t), (void *)paramReq); } else @@ -1882,7 +1883,6 @@ S16 lwr_mac_handleConfigReqEvt(void *msg) uint8_t idx = 0; uint8_t index = 0; uint32_t msgLen = 0; - uint32_t configReqSize; RgCellCb *cellParams; MacCellCfg macCfgParams; fapi_config_req_t *configReq; @@ -1893,10 +1893,10 @@ S16 lwr_mac_handleConfigReqEvt(void *msg) cellParams = rgCb[inst].cell; macCfgParams = cellParams->macCellCfg; - configReqSize = sizeof(fapi_config_req_t); - LWR_MAC_ALLOC(configReq, configReqSize); + LWR_MAC_ALLOC(configReq, sizeof(fapi_config_req_t)); if(configReq != NULL) { + memset(configReq, 0, sizeof(fapi_config_req_t)); msgLen = sizeof(macCfgParams.numTlv); configReq->number_of_tlvs = macCfgParams.numTlv; @@ -2006,17 +2006,18 @@ S16 lwr_mac_handleConfigReqEvt(void *msg) sizeof(uint8_t), macCfgParams.tddCfg.slotCfg[0][0], &msgLen); /* fill measurement config */ - fillTlvs(&configReq->tlvs[index++], FAPI_RSSI_MESUREMENT_TAG, \ + fillTlvs(&configReq->tlvs[index++], FAPI_RSSI_MEASUREMENT_TAG, \ sizeof(uint8_t), macCfgParams.rssiUnit, &msgLen); /* fill DMRS Type A Pos */ fillTlvs(&configReq->tlvs[index++], FAPI_DMRS_TYPE_A_POS_TAG, \ sizeof(uint8_t), macCfgParams.dmrsTypeAPos, &msgLen); - fillMsgHeader(&configReq->header, FAPI_CONFIG_REQUEST, msgLen); + fillMsgHeader(&configReq->header, FAPI_CONFIG_REQUEST, \ + (sizeof(fapi_config_req_t) - sizeof(fapi_msg_t))); DU_LOG("\nLWR_MAC: Sending Config Request to Phy"); - LwrMacSendToPhy(configReq->header.message_type_id, configReqSize, (void *)configReq); + LwrMacSendToPhy(configReq->header.msg_id, sizeof(fapi_config_req_t), (void *)configReq); } else { @@ -2107,10 +2108,11 @@ S16 lwr_mac_handleStartReqEvt(void *msg) LWR_MAC_ALLOC(startReq, sizeof(fapi_start_req_t)); if(startReq != NULL) { + memset(startReq, 0, sizeof(fapi_start_req_t)); fillMsgHeader(&startReq->header, FAPI_START_REQUEST, msgLen); DU_LOG("\nLWR_MAC: Sending Start Request to PHY"); - LwrMacSendToPhy(startReq->header.message_type_id, sizeof(fapi_start_req_t),\ + LwrMacSendToPhy(startReq->header.msg_id, sizeof(fapi_start_req_t),\ (void *)startReq); } else @@ -2147,9 +2149,10 @@ S16 lwr_mac_handleStopReqEvt(void *msg) LWR_MAC_ALLOC(stopReq, sizeof(fapi_stop_req_t)); if(stopReq != NULLP) { + memset(stopReq, 0, sizeof(fapi_stop_req_t)); fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, msgLen); DU_LOG("\nLOWER MAC: Sending Stop Request to PHY"); - LwrMacSendToPhy(stopReq->header.message_type_id, sizeof(fapi_stop_req_t), (void *)stopReq); + LwrMacSendToPhy(stopReq->header.msg_id, sizeof(fapi_stop_req_t), (void *)stopReq); } else { @@ -2204,37 +2207,33 @@ PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn) ******************************************************************/ S16 fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg, - MacDlSlot *currDlSlot, uint32_t *msgLen, uint8_t ssbIdxCount, uint16_t sfn) + MacDlSlot *currDlSlot, uint8_t ssbIdxCount, uint16_t sfn) { uint32_t mibPayload = 0; if(dlTtiReqPdu != NULL) { 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 = currDlSlot->dlInfo.brdcstAlloc.ssbInfo[ssbIdxCount].ssbIdx; - dlTtiReqPdu->u.ssb_pdu.ssbSubCarrierOffset = macCellCfg->ssbCfg.ssbScOffset; + dlTtiReqPdu->pdu.ssb_pdu.physCellId = macCellCfg->phyCellId; + dlTtiReqPdu->pdu.ssb_pdu.betaPss = macCellCfg->ssbCfg.betaPss; + dlTtiReqPdu->pdu.ssb_pdu.ssbBlockIndex = currDlSlot->dlInfo.brdcstAlloc.ssbInfo[ssbIdxCount].ssbIdx; + dlTtiReqPdu->pdu.ssb_pdu.ssbSubCarrierOffset = macCellCfg->ssbCfg.ssbScOffset; /* ssbOfPdufstA to be filled in ssbCfg */ - dlTtiReqPdu->u.ssb_pdu.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA; - dlTtiReqPdu->u.ssb_pdu.bchPayloadFlag = macCellCfg->ssbCfg.bchPayloadFlag; + dlTtiReqPdu->pdu.ssb_pdu.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA; + dlTtiReqPdu->pdu.ssb_pdu.bchPayloadFlag = macCellCfg->ssbCfg.bchPayloadFlag; /* Bit manipulation for SFN */ setMibPdu(macCellCfg->ssbCfg.mibPdu, &mibPayload, sfn); - dlTtiReqPdu->u.ssb_pdu.bchPayload.v.bchPayload = mibPayload; - dlTtiReqPdu->u.ssb_pdu.preCodingAndBeamforming.numPrgs = 0; - dlTtiReqPdu->u.ssb_pdu.preCodingAndBeamforming.prgSize = 0; - dlTtiReqPdu->u.ssb_pdu.preCodingAndBeamforming.digBfInterfaces = 0; - dlTtiReqPdu->u.ssb_pdu.preCodingAndBeamforming.pmi_bfi[0].pmIdx = 0; - dlTtiReqPdu->u.ssb_pdu.preCodingAndBeamforming. \ + dlTtiReqPdu->pdu.ssb_pdu.bchPayload.bchPayload = mibPayload; + dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.numPrgs = 0; + dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.prgSize = 0; + dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.digBfInterfaces = 0; + dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.pmi_bfi[0].pmIdx = 0; + dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming. \ pmi_bfi[0].beamIdx[0].beamidx = macCellCfg->ssbCfg.beamId[0]; dlTtiReqPdu->pduSize = sizeof(fapi_dl_ssb_pdu_t); /* Size of SSB PDU */ - SET_MSG_LEN(*msgLen, (sizeof(dlTtiReqPdu->pduType) + \ - sizeof(dlTtiReqPdu->pduSize) + sizeof(fapi_dl_ssb_pdu_t))); + return ROK; } - else - { - return RFAILED; - } + return RFAILED; } /******************************************************************* @@ -2345,7 +2344,7 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) if(dlDciPtr->payloadSizeBits % 8) numBytes += 1; - if(numBytes > DCI_PAYLOAD_BYTE_LEN) + if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) { DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); return; @@ -2479,7 +2478,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) if(dlDciPtr->payloadSizeBits % 8) numBytes += 1; - if(numBytes > DCI_PAYLOAD_BYTE_LEN) + if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) { DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); return; @@ -2637,7 +2636,7 @@ Msg4Info *msg4Info) if(dlDciPtr->payloadSizeBits % 8) numBytes += 1; - if(numBytes > DCI_PAYLOAD_BYTE_LEN) + if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) { DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); return; @@ -2694,38 +2693,35 @@ Msg4Info *msg4Info) * * @params[in] Pointer to FAPI DL TTI Req * Pointer to PdcchCfg - * Pointer to msgLen of DL TTI Info * @return ROK * ******************************************************************/ -S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, uint32_t *msgLen, RntiType rntiType) +uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \ + RntiType rntiType, uint8_t coreSetType) { if(dlTtiReqPdu != NULLP) { PdcchCfg *pdcchInfo = NULLP; BwpCfg *bwp = NULLP; - dlTtiReqPdu->u.pdcch_pdu.dlDci = (fapi_dl_dci_t *)(dlTtiReqPdu + \ - (sizeof(fapi_dl_tti_req_pdu_t) - sizeof(dlTtiReqPdu->u)) + \ - (sizeof(fapi_dl_pdcch_pdu_t) - sizeof(fapi_dl_dci_t*))); - + memset(&dlTtiReqPdu->pdu.pdcch_pdu, 0, sizeof(fapi_dl_pdcch_pdu_t)); if(rntiType == SI_RNTI_TYPE) { pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg; bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp; - fillSib1DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo); + fillSib1DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo); } else if(rntiType == RA_RNTI_TYPE) { pdcchInfo = &dlInfo->rarAlloc->rarPdcchCfg; bwp = &dlInfo->rarAlloc->bwp; - fillRarDlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo); + fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo); } else if(rntiType == TC_RNTI_TYPE) { pdcchInfo = &dlInfo->msg4Alloc->msg4PdcchCfg; bwp = &dlInfo->msg4Alloc->bwp; - fillMsg4DlDciPdu(dlTtiReqPdu->u.pdcch_pdu.dlDci, pdcchInfo,\ + fillMsg4DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\ &dlInfo->msg4Alloc->msg4Info); } else @@ -2734,26 +2730,24 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, uint32 return RFAILED;; } dlTtiReqPdu->pduType = PDCCH_PDU_TYPE; - dlTtiReqPdu->u.pdcch_pdu.bwpSize = bwp->freqAlloc.numPrb; - dlTtiReqPdu->u.pdcch_pdu.bwpPart = bwp->freqAlloc.startPrb; - dlTtiReqPdu->u.pdcch_pdu.subCarrierSpacing = bwp->subcarrierSpacing; - dlTtiReqPdu->u.pdcch_pdu.cyclicPrefix = bwp->cyclicPrefix; - dlTtiReqPdu->u.pdcch_pdu.startSymbolIndex = pdcchInfo->coreset0Cfg.startSymbolIndex; - dlTtiReqPdu->u.pdcch_pdu.durationSymbols = pdcchInfo->coreset0Cfg.durationSymbols; - memcpy(dlTtiReqPdu->u.pdcch_pdu.freqDomainResource, pdcchInfo->coreset0Cfg.freqDomainResource, 6); - dlTtiReqPdu->u.pdcch_pdu.cceRegMappingType = pdcchInfo->coreset0Cfg.cceRegMappingType; - dlTtiReqPdu->u.pdcch_pdu.regBundleSize = pdcchInfo->coreset0Cfg.regBundleSize; - dlTtiReqPdu->u.pdcch_pdu.interleaverSize = pdcchInfo->coreset0Cfg.interleaverSize; - dlTtiReqPdu->u.pdcch_pdu.coreSetSize = pdcchInfo->coreset0Cfg.coreSetType; - dlTtiReqPdu->u.pdcch_pdu.shiftIndex = pdcchInfo->coreset0Cfg.shiftIndex; - dlTtiReqPdu->u.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity; - dlTtiReqPdu->u.pdcch_pdu.numDlDci = pdcchInfo->numDlDci; + dlTtiReqPdu->pdu.pdcch_pdu.bwpSize = bwp->freqAlloc.numPrb; + dlTtiReqPdu->pdu.pdcch_pdu.bwpStart = bwp->freqAlloc.startPrb; + dlTtiReqPdu->pdu.pdcch_pdu.subCarrierSpacing = bwp->subcarrierSpacing; + dlTtiReqPdu->pdu.pdcch_pdu.cyclicPrefix = bwp->cyclicPrefix; + dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex = pdcchInfo->coreset0Cfg.startSymbolIndex; + dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols = pdcchInfo->coreset0Cfg.durationSymbols; + memcpy(dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource, pdcchInfo->coreset0Cfg.freqDomainResource, 6); + dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType = pdcchInfo->coreset0Cfg.cceRegMappingType; + dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize = pdcchInfo->coreset0Cfg.regBundleSize; + dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize = pdcchInfo->coreset0Cfg.interleaverSize; + dlTtiReqPdu->pdu.pdcch_pdu.coreSetSize = pdcchInfo->coreset0Cfg.coreSetType; + dlTtiReqPdu->pdu.pdcch_pdu.shiftIndex = pdcchInfo->coreset0Cfg.shiftIndex; + dlTtiReqPdu->pdu.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity; + dlTtiReqPdu->pdu.pdcch_pdu.numDlDci = pdcchInfo->numDlDci; + dlTtiReqPdu->pdu.pdcch_pdu.coreSetType = coreSetType; /* Calculating PDU length. Considering only one dl dci pdu for now */ - dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t) + sizeof(fapi_dl_dci_t); - SET_MSG_LEN(*msgLen, (sizeof(dlTtiReqPdu->pduType) + \ - sizeof(dlTtiReqPdu->pduSize) + dlTtiReqPdu->pduSize)); - + dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t); } return ROK; @@ -2779,63 +2773,63 @@ S16 fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, uint32 ******************************************************************/ void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, PdschCfg *pdschInfo, - BwpCfg bwp,uint32_t *msgLen, uint16_t pduIndex) + BwpCfg bwp, uint16_t pduIndex) { uint8_t idx; if(dlTtiReqPdu != NULLP) { dlTtiReqPdu->pduType = PDSCH_PDU_TYPE; - dlTtiReqPdu->u.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap; - dlTtiReqPdu->u.pdsch_pdu.rnti = pdschInfo->rnti; - dlTtiReqPdu->u.pdsch_pdu.pduIndex = pduIndex; - dlTtiReqPdu->u.pdsch_pdu.bwpSize = bwp.freqAlloc.numPrb; - dlTtiReqPdu->u.pdsch_pdu.bwpStart = bwp.freqAlloc.startPrb; - dlTtiReqPdu->u.pdsch_pdu.subCarrierSpacing = bwp.subcarrierSpacing; - dlTtiReqPdu->u.pdsch_pdu.cyclicPrefix = bwp.cyclicPrefix; - dlTtiReqPdu->u.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords; + memset(&dlTtiReqPdu->pdu.pdsch_pdu, 0, sizeof(fapi_dl_pdsch_pdu_t)); + dlTtiReqPdu->pdu.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap; + dlTtiReqPdu->pdu.pdsch_pdu.rnti = pdschInfo->rnti; + dlTtiReqPdu->pdu.pdsch_pdu.pdu_index = pduIndex; + dlTtiReqPdu->pdu.pdsch_pdu.bwpSize = bwp.freqAlloc.numPrb; + dlTtiReqPdu->pdu.pdsch_pdu.bwpStart = bwp.freqAlloc.startPrb; + dlTtiReqPdu->pdu.pdsch_pdu.subCarrierSpacing = bwp.subcarrierSpacing; + dlTtiReqPdu->pdu.pdsch_pdu.cyclicPrefix = bwp.cyclicPrefix; + dlTtiReqPdu->pdu.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords; for(idx = 0; idx < MAX_CODEWORDS ; idx++) { - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].targetCodeRate = pdschInfo->codeword[idx].targetCodeRate; - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].qamModOrder = pdschInfo->codeword[idx].qamModOrder; - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].mcsIndex = pdschInfo->codeword[idx].mcsIndex; - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].mcsTable = pdschInfo->codeword[idx].mcsTable; - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].rvIndex = pdschInfo->codeword[idx].rvIndex; - dlTtiReqPdu->u.pdsch_pdu.cwInfo[idx].tbSize = pdschInfo->codeword[idx].tbSize; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].targetCodeRate = pdschInfo->codeword[idx].targetCodeRate; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].qamModOrder = pdschInfo->codeword[idx].qamModOrder; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsIndex = pdschInfo->codeword[idx].mcsIndex; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsTable = pdschInfo->codeword[idx].mcsTable; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].rvIndex = pdschInfo->codeword[idx].rvIndex; + dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].tbSize = pdschInfo->codeword[idx].tbSize; } - dlTtiReqPdu->u.pdsch_pdu.dataScramblingId = pdschInfo->dataScramblingId; - dlTtiReqPdu->u.pdsch_pdu.nrOfLayers = pdschInfo->numLayers; - dlTtiReqPdu->u.pdsch_pdu.transmissionScheme = pdschInfo->transmissionScheme; - dlTtiReqPdu->u.pdsch_pdu.refPoint = pdschInfo->refPoint; - dlTtiReqPdu->u.pdsch_pdu.dlDmrsSymbPos = pdschInfo->dmrs.dlDmrsSymbPos; - dlTtiReqPdu->u.pdsch_pdu.dmrsConfigType = pdschInfo->dmrs.dmrsConfigType; - dlTtiReqPdu->u.pdsch_pdu.dlDmrsScramblingId = pdschInfo->dmrs.dlDmrsScramblingId; - dlTtiReqPdu->u.pdsch_pdu.scid = pdschInfo->dmrs.scid; - dlTtiReqPdu->u.pdsch_pdu.numDmrsCdmGrpsNoData = pdschInfo->dmrs.numDmrsCdmGrpsNoData; - dlTtiReqPdu->u.pdsch_pdu.dmrsPorts = pdschInfo->dmrs.dmrsPorts; - dlTtiReqPdu->u.pdsch_pdu.resourceAlloc = pdschInfo->pdschFreqAlloc.resourceAllocType; + dlTtiReqPdu->pdu.pdsch_pdu.dataScramblingId = pdschInfo->dataScramblingId; + dlTtiReqPdu->pdu.pdsch_pdu.nrOfLayers = pdschInfo->numLayers; + dlTtiReqPdu->pdu.pdsch_pdu.transmissionScheme = pdschInfo->transmissionScheme; + dlTtiReqPdu->pdu.pdsch_pdu.refPoint = pdschInfo->refPoint; + dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsSymbPos = pdschInfo->dmrs.dlDmrsSymbPos; + dlTtiReqPdu->pdu.pdsch_pdu.dmrsConfigType = pdschInfo->dmrs.dmrsConfigType; + dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsScramblingId = pdschInfo->dmrs.dlDmrsScramblingId; + dlTtiReqPdu->pdu.pdsch_pdu.scid = pdschInfo->dmrs.scid; + dlTtiReqPdu->pdu.pdsch_pdu.numDmrsCdmGrpsNoData = pdschInfo->dmrs.numDmrsCdmGrpsNoData; + dlTtiReqPdu->pdu.pdsch_pdu.dmrsPorts = pdschInfo->dmrs.dmrsPorts; + dlTtiReqPdu->pdu.pdsch_pdu.resourceAlloc = pdschInfo->pdschFreqAlloc.resourceAllocType; /* since we are using type-1, hence rbBitmap excluded */ - dlTtiReqPdu->u.pdsch_pdu.rbStart = pdschInfo->pdschFreqAlloc.freqAlloc.startPrb; - dlTtiReqPdu->u.pdsch_pdu.rbSize = pdschInfo->pdschFreqAlloc.freqAlloc.numPrb; - dlTtiReqPdu->u.pdsch_pdu.vrbToPrbMapping = pdschInfo->pdschFreqAlloc.vrbPrbMapping; - dlTtiReqPdu->u.pdsch_pdu.startSymbIndex = pdschInfo->pdschTimeAlloc.timeAlloc.startSymb; - dlTtiReqPdu->u.pdsch_pdu.nrOfSymbols = pdschInfo->pdschTimeAlloc.timeAlloc.numSymb; - dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.numPrgs = pdschInfo->beamPdschInfo.numPrgs; - dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.prgSize = pdschInfo->beamPdschInfo.prgSize; - dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = pdschInfo->beamPdschInfo.digBfInterfaces; - dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ + dlTtiReqPdu->pdu.pdsch_pdu.rbStart = pdschInfo->pdschFreqAlloc.freqAlloc.startPrb; + dlTtiReqPdu->pdu.pdsch_pdu.rbSize = pdschInfo->pdschFreqAlloc.freqAlloc.numPrb; + dlTtiReqPdu->pdu.pdsch_pdu.vrbToPrbMapping = pdschInfo->pdschFreqAlloc.vrbPrbMapping; + dlTtiReqPdu->pdu.pdsch_pdu.startSymbIndex = pdschInfo->pdschTimeAlloc.timeAlloc.startSymb; + dlTtiReqPdu->pdu.pdsch_pdu.nrOfSymbols = pdschInfo->pdschTimeAlloc.timeAlloc.numSymb; + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.numPrgs = pdschInfo->beamPdschInfo.numPrgs; + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.prgSize = pdschInfo->beamPdschInfo.prgSize; + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = pdschInfo->beamPdschInfo.digBfInterfaces; + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ pmIdx = pdschInfo->beamPdschInfo.prg[0].pmIdx; - dlTtiReqPdu->u.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \ beamIdx[0].beamidx = pdschInfo->beamPdschInfo.prg[0].beamIdx[0]; - dlTtiReqPdu->u.pdsch_pdu.powerControlOffset = pdschInfo->txPdschPower.powerControlOffset; - dlTtiReqPdu->u.pdsch_pdu.powerControlOffsetSS = pdschInfo->txPdschPower.powerControlOffsetSS; - dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t); - - SET_MSG_LEN(*msgLen, (sizeof(dlTtiReqPdu->pduType) + \ - sizeof(dlTtiReqPdu->pduSize) + sizeof(fapi_dl_pdsch_pdu_t))); + dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffset = pdschInfo->txPdschPower.powerControlOffset; + dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffsetSS = pdschInfo->txPdschPower.powerControlOffsetSS; + dlTtiReqPdu->pdu.pdsch_pdu.mappingType = pdschInfo->dmrs.mappingType; + dlTtiReqPdu->pdu.pdsch_pdu.nrOfDmrsSymbols = pdschInfo->dmrs.nrOfDmrsSymbols; + dlTtiReqPdu->pdu.pdsch_pdu.dmrsAddPos = pdschInfo->dmrs.dmrsAddPos; + dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t); } - } /*********************************************************************** @@ -2941,13 +2935,13 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo) * * ********************************************************************/ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg, - uint32_t *msgLen, uint16_t pduIndex) + uint16_t pduIndex) { uint32_t pduLen = 0; - uint32_t *sib1TxdataValue = NULLP; + uint8_t *sib1TxdataValue = NULLP; - pduDesc[pduIndex].pduIndex = pduIndex; - pduDesc[pduIndex].numTlvs = 1; + pduDesc[pduIndex].pdu_index = pduIndex; + pduDesc[pduIndex].num_tlvs = 1; /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ @@ -2964,9 +2958,8 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg, /* 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[pduIndex].pduLength = pduLen; - msgLen += pduLen; + pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */ + pduDesc[pduIndex].pdu_length = pduLen; #ifndef INTEL_WLS MAC_FREE(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen); @@ -2994,13 +2987,13 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg, * * ********************************************************************/ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo, - uint32_t *msgLen, uint16_t pduIndex) + uint16_t pduIndex) { uint32_t pduLen = 0; - uint32_t *rarTxdataValue = NULLP; + uint8_t *rarTxdataValue = NULLP; - pduDesc[pduIndex].pduIndex = pduIndex; - pduDesc[pduIndex].numTlvs = 1; + pduDesc[pduIndex].pdu_index = pduIndex; + pduDesc[pduIndex].num_tlvs = 1; /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ @@ -3012,13 +3005,12 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo, return RFAILED; } memcpy(rarTxdataValue,rarInfo->rarPdu,rarInfo->rarPduLen); - pduDesc[pduIndex].tlvs[0].value = (uint32_t)rarTxdataValue; + pduDesc[pduIndex].tlvs[0].value = 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[pduIndex].pduLength = pduLen; - msgLen += pduLen; + pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */ + pduDesc[pduIndex].pdu_length = 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 @@ -3049,14 +3041,13 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo, * * ********************************************************************/ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, - uint32_t *msgLen, uint16_t pduIndex) + uint16_t pduIndex) { - uint16_t idx = 0; uint32_t pduLen = 0; - uint32_t *msg4TxDataValue = NULLP; + uint8_t *msg4TxDataValue = NULLP; - pduDesc[pduIndex].pduIndex = pduIndex; - pduDesc[pduIndex].numTlvs = 1; + pduDesc[pduIndex].pdu_index = pduIndex; + pduDesc[pduIndex].num_tlvs = 1; /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ @@ -3067,17 +3058,13 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, { return RFAILED; } - for(idx = 0; idx < msg4Info->msg4PduLen; idx++) - { - msg4TxDataValue[idx] = msg4Info->msg4Pdu[idx]; - } - pduDesc[pduIndex].tlvs[0].value = (uint32_t)msg4TxDataValue; + memcpy(msg4TxDataValue, msg4Info->msg4Pdu, msg4Info->msg4PduLen); + pduDesc[pduIndex].tlvs[0].value = msg4TxDataValue; /* 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[pduIndex].pduLength = pduLen; - msgLen += pduLen; + pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */ + pduDesc[pduIndex].pdu_length = 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 @@ -3114,7 +3101,6 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) uint8_t numPduEncoded = 0; uint16_t pduIndex = 0; uint32_t msgLen = 0; - uint32_t dlTtiReqMsgSize = 0; fapi_dl_tti_req_t *dlTtiReq = NULLP; SlotIndInfo dlTtiReqTimingInfo; @@ -3136,30 +3122,10 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) currDlSlot = &macCb.macCell->dlSlot[dlTtiReqTimingInfo.slot]; nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo); - dlTtiReqMsgSize = sizeof(fapi_dl_tti_req_t) + (nPdu * \ - sizeof(fapi_dl_tti_req_pdu_t)); - if(nPdu > 0) - { - if(currDlSlot->dlInfo.isBroadcastPres) - { - if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans) - { - dlTtiReqMsgSize += sizeof(fapi_dl_dci_t); - } - } - if(currDlSlot->dlInfo.rarAlloc != NULLP) - { - dlTtiReqMsgSize += sizeof(fapi_dl_dci_t); - } - if(currDlSlot->dlInfo.msg4Alloc != NULLP) - { - dlTtiReqMsgSize += sizeof(fapi_dl_dci_t); - } - } - LWR_MAC_ALLOC(dlTtiReq, dlTtiReqMsgSize); + LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t)); if(dlTtiReq != NULLP) { - memset(dlTtiReq, 0, dlTtiReqMsgSize); + memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t)); dlTtiReq->sfn = dlTtiReqTimingInfo.sfn; dlTtiReq->slot = dlTtiReqTimingInfo.slot; dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo); /* get total Pdus */ @@ -3168,14 +3134,6 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) if(dlTtiReq->nPdus > 0) { - dlTtiReq->pdus = (fapi_dl_tti_req_pdu_t*)(dlTtiReq + \ - (sizeof(fapi_dl_tti_req_t) - sizeof(fapi_dl_tti_req_pdu_t*))); - if(!dlTtiReq->pdus) - { - DU_LOG("\nLWR_MAC: Memory allocation failed"); - return RFAILED; - } - if(currDlSlot->dlInfo.isBroadcastPres) { if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans) @@ -3185,7 +3143,7 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++) { fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\ - currDlSlot, &msgLen, idx, dlTtiReq->sfn); + currDlSlot, idx, dlTtiReq->sfn); numPduEncoded++; } } @@ -3200,12 +3158,12 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) { rntiType = SI_RNTI_TYPE; fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\ - &msgLen, rntiType); + rntiType, CORESET_TYPE0); numPduEncoded++; fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg, currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp, - &msgLen, pduIndex); + pduIndex); pduIndex++; numPduEncoded++; } @@ -3219,12 +3177,12 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) /* Filling RAR param */ rntiType = RA_RNTI_TYPE; fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ - &currDlSlot->dlInfo, &msgLen, rntiType); + &currDlSlot->dlInfo, rntiType, CORESET_TYPE0); numPduEncoded++; fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.rarAlloc->rarPdschCfg, currDlSlot->dlInfo.rarAlloc->bwp, - &msgLen, pduIndex); + pduIndex); numPduEncoded++; pduIndex++; @@ -3237,12 +3195,12 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) /* Filling Msg4 param */ rntiType = TC_RNTI_TYPE; fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ - &currDlSlot->dlInfo, &msgLen, rntiType); + &currDlSlot->dlInfo, rntiType, CORESET_TYPE0); numPduEncoded++; fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg, currDlSlot->dlInfo.msg4Alloc->bwp, - &msgLen, pduIndex); + pduIndex); numPduEncoded++; pduIndex++; @@ -3250,9 +3208,9 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) DU_LOG("\nLWR_MAC: MSG4 sent..."); printf("\033[0m"); } - msgLen += sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); + msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); - LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, \ + LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), \ (void *)dlTtiReq); /* send Tx-DATA req message */ @@ -3262,7 +3220,7 @@ uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo) { msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); - LwrMacSendToPhy(dlTtiReq->header.message_type_id, dlTtiReqMsgSize, (void *)dlTtiReq); + LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), (void *)dlTtiReq); } memset(currDlSlot, 0, sizeof(MacDlSlot)); return ROK; @@ -3305,7 +3263,7 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) uint8_t nPdu = 0; uint32_t msgLen = 0; uint16_t pduIndex = 0; - uint32_t txDataReqMsgSize = 0; + uint32_t txDataReqMsgSize = 0; fapi_tx_data_req_t *txDataReq = NULLP; Inst inst = 0; @@ -3313,8 +3271,7 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) nPdu = calcTxDataReqPduCount(dlInfo); if(nPdu > 0) { - txDataReqMsgSize = sizeof(fapi_tx_data_req_t) + \ - (nPdu * sizeof(fapi_tx_pdu_desc_t)); + txDataReqMsgSize = sizeof(fapi_tx_data_req_t); if(dlInfo->brdcstAlloc.sib1Trans) { txDataReqMsgSize += rgCb[inst].cell->macCellCfg.sib1Cfg.sib1PduLen; @@ -3338,31 +3295,28 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) memset(txDataReq, 0, txDataReqMsgSize); txDataReq->sfn = currTimingInfo.sfn; txDataReq->slot = currTimingInfo.slot; - txDataReq->pduDesc = (fapi_tx_pdu_desc_t *)(txDataReq + \ - (sizeof(fapi_tx_data_req_t) - sizeof(fapi_tx_pdu_desc_t *))); - if(dlInfo->brdcstAlloc.sib1Trans) { - fillSib1TxDataReq(txDataReq->pduDesc, - &rgCb[inst].cell->macCellCfg, &msgLen, pduIndex); + fillSib1TxDataReq(txDataReq->pdu_desc, + &rgCb[inst].cell->macCellCfg, pduIndex); pduIndex++; - txDataReq->numPdus++; + txDataReq->num_pdus++; } if(dlInfo->rarAlloc != NULLP) { - fillRarTxDataReq(txDataReq->pduDesc, &dlInfo->rarAlloc->rarInfo, &msgLen, pduIndex); + fillRarTxDataReq(txDataReq->pdu_desc, &dlInfo->rarAlloc->rarInfo, pduIndex); pduIndex++; - txDataReq->numPdus++; + txDataReq->num_pdus++; MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc)); dlInfo->rarAlloc = NULLP; } if(dlInfo->msg4Alloc != NULLP && dlInfo->msg4Alloc->msg4Info.msg4Pdu != NULLP) { - fillMsg4TxDataReq(txDataReq->pduDesc, &dlInfo->msg4Alloc->\ - msg4Info, &msgLen, pduIndex); + fillMsg4TxDataReq(txDataReq->pdu_desc, &dlInfo->msg4Alloc->\ + msg4Info, pduIndex); pduIndex++; - txDataReq->numPdus++; + txDataReq->num_pdus++; MAC_FREE(dlInfo->msg4Alloc->msg4Info.msg4Pdu,\ dlInfo->msg4Alloc->msg4Info.msg4PduLen); @@ -3370,9 +3324,9 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc)); dlInfo->msg4Alloc = NULLP; } - msgLen += sizeof(fapi_tx_data_req_t) - sizeof(fapi_msg_t); + msgLen = txDataReqMsgSize - sizeof(fapi_msg_t); fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen); - LwrMacSendToPhy(txDataReq->header.message_type_id, txDataReqMsgSize, \ + LwrMacSendToPhy(txDataReq->header.msg_id, txDataReqMsgSize, \ (void *)txDataReq); } #endif @@ -3404,7 +3358,7 @@ uint8_t getnPdus(fapi_ul_tti_req_t *ulTtiReq, MacUlSlot *currUlSlot) if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH) { pduCount++; - ulTtiReq->rachPresent = PDU_PRESENT; + ulTtiReq->rachPresent++; } if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH) { @@ -3413,19 +3367,19 @@ uint8_t getnPdus(fapi_ul_tti_req_t *ulTtiReq, MacUlSlot *currUlSlot) } if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH_UCI) { - pduCount++; - ulTtiReq->nUlsch = PDU_PRESENT; - } - if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI) - { - pduCount++; - ulTtiReq->nUlcch = PDU_PRESENT; - } - if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS) - { - pduCount++; - } - } + pduCount++; + ulTtiReq->nUlsch++; + } + if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI) + { + pduCount++; + ulTtiReq->nUlcch++; + } + if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS) + { + pduCount++; + } + } return pduCount; } #endif @@ -3445,7 +3399,7 @@ uint8_t getnPdus(fapi_ul_tti_req_t *ulTtiReq, MacUlSlot *currUlSlot) * Pointer to MacCellCfg * ********************************************************************/ -void setNumCs(uint8_t *numCs, MacCellCfg *macCellCfg) +void setNumCs(uint16_t *numCs, MacCellCfg *macCellCfg) { #ifdef INTEL_FAPI uint8_t idx; @@ -3475,138 +3429,136 @@ void setNumCs(uint8_t *numCs, MacCellCfg *macCellCfg) * ********************************************************************/ #ifdef INTEL_FAPI -void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, MacUlSlot *currUlSlot, uint32_t *msgLen) +void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, MacUlSlot *currUlSlot) { if(ulTtiReqPdu != NULLP) { ulTtiReqPdu->pduType = PRACH_PDU_TYPE; - ulTtiReqPdu->u.prach_pdu.physCellId = macCellCfg->phyCellId; - ulTtiReqPdu->u.prach_pdu.numPrachOcas = currUlSlot->ulInfo.prachSchInfo.numPrachOcas; - ulTtiReqPdu->u.prach_pdu.prachFormat = \ + ulTtiReqPdu->pdu.prach_pdu.physCellId = macCellCfg->phyCellId; + ulTtiReqPdu->pdu.prach_pdu.numPrachOcas = currUlSlot->ulInfo.prachSchInfo.numPrachOcas; + ulTtiReqPdu->pdu.prach_pdu.prachFormat = \ currUlSlot->ulInfo.prachSchInfo.prachFormat; - ulTtiReqPdu->u.prach_pdu.numRa = currUlSlot->ulInfo.prachSchInfo.numRa; - ulTtiReqPdu->u.prach_pdu.prachStartSymbol = \ + ulTtiReqPdu->pdu.prach_pdu.numRa = currUlSlot->ulInfo.prachSchInfo.numRa; + ulTtiReqPdu->pdu.prach_pdu.prachStartSymbol = \ currUlSlot->ulInfo.prachSchInfo.prachStartSymb; - setNumCs(&ulTtiReqPdu->u.prach_pdu.numCs, macCellCfg); - ulTtiReqPdu->u.prach_pdu.beamforming.numPrgs = 0; - ulTtiReqPdu->u.prach_pdu.beamforming.prgSize = 0; - ulTtiReqPdu->u.prach_pdu.beamforming.digBfInterfaces = 0; - ulTtiReqPdu->u.prach_pdu.beamforming.pmi_bfi[0].pmIdx = 0; - ulTtiReqPdu->u.prach_pdu.beamforming.pmi_bfi[0].beamIdx[0].beamidx = 0; + setNumCs(&ulTtiReqPdu->pdu.prach_pdu.numCs, macCellCfg); + ulTtiReqPdu->pdu.prach_pdu.beamforming.numPrgs = 0; + ulTtiReqPdu->pdu.prach_pdu.beamforming.prgSize = 0; + ulTtiReqPdu->pdu.prach_pdu.beamforming.digBfInterface = 0; + ulTtiReqPdu->pdu.prach_pdu.beamforming.rx_bfi[0].beamIdx[0].beamidx = 0; ulTtiReqPdu->pduSize = sizeof(fapi_ul_prach_pdu_t); - - SET_MSG_LEN(*msgLen, (sizeof(ulTtiReqPdu->pduType) + \ - sizeof(ulTtiReqPdu->pduSize) + sizeof(fapi_ul_prach_pdu_t))); } } -void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, MacUlSlot *currUlSlot, uint32_t *msgLen) +void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, MacUlSlot *currUlSlot) { if(ulTtiReqPdu != NULLP) { ulTtiReqPdu->pduType = PUSCH_PDU_TYPE; - ulTtiReqPdu->u.pusch_pdu.pduBitMap = 1; - ulTtiReqPdu->u.pusch_pdu.rnti = currUlSlot->ulInfo.crnti; + memset(&ulTtiReqPdu->pdu.pusch_pdu, 0, sizeof(fapi_ul_pusch_pdu_t)); + ulTtiReqPdu->pdu.pusch_pdu.pduBitMap = 1; + ulTtiReqPdu->pdu.pusch_pdu.rnti = currUlSlot->ulInfo.crnti; /* TODO : Fill handle in raCb when scheduling pusch and access here */ - ulTtiReqPdu->u.pusch_pdu.handle = 100; - ulTtiReqPdu->u.pusch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb; - ulTtiReqPdu->u.pusch_pdu.bwpStart = macCellCfg->initialUlBwp.bwp.firstPrb; - ulTtiReqPdu->u.pusch_pdu.subCarrierSpacing = \ + ulTtiReqPdu->pdu.pusch_pdu.handle = 100; + ulTtiReqPdu->pdu.pusch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb; + ulTtiReqPdu->pdu.pusch_pdu.bwpStart = macCellCfg->initialUlBwp.bwp.firstPrb; + ulTtiReqPdu->pdu.pusch_pdu.subCarrierSpacing = \ macCellCfg->initialUlBwp.bwp.scs; - ulTtiReqPdu->u.pusch_pdu.cyclicPrefix = \ + ulTtiReqPdu->pdu.pusch_pdu.cyclicPrefix = \ macCellCfg->initialUlBwp.bwp.cyclicPrefix; - ulTtiReqPdu->u.pusch_pdu.targetCodeRate = 308; - ulTtiReqPdu->u.pusch_pdu.qamModOrder = 2; - ulTtiReqPdu->u.pusch_pdu.mcsIndex = \ + ulTtiReqPdu->pdu.pusch_pdu.targetCodeRate = 308; + ulTtiReqPdu->pdu.pusch_pdu.qamModOrder = 2; + ulTtiReqPdu->pdu.pusch_pdu.mcsIndex = \ currUlSlot->ulInfo.schPuschInfo.tbInfo.mcs; - ulTtiReqPdu->u.pusch_pdu.mcsTable = 0; - ulTtiReqPdu->u.pusch_pdu.transformPrecoding = 1; - ulTtiReqPdu->u.pusch_pdu.dataScramblingId = currUlSlot->ulInfo.cellId; - ulTtiReqPdu->u.pusch_pdu.nrOfLayers = 1; - ulTtiReqPdu->u.pusch_pdu.ulDmrsSymbPos = 4; - ulTtiReqPdu->u.pusch_pdu.dmrsConfigType = 0; - ulTtiReqPdu->u.pusch_pdu.ulDmrsScramblingId = currUlSlot->ulInfo.cellId; - ulTtiReqPdu->u.pusch_pdu.scid = 0; - ulTtiReqPdu->u.pusch_pdu.numDmrsCdmGrpsNoData = 1; - ulTtiReqPdu->u.pusch_pdu.dmrsPorts = 0; - ulTtiReqPdu->u.pusch_pdu.resourceAlloc = \ + ulTtiReqPdu->pdu.pusch_pdu.mcsTable = 0; + ulTtiReqPdu->pdu.pusch_pdu.transformPrecoding = 1; + ulTtiReqPdu->pdu.pusch_pdu.dataScramblingId = currUlSlot->ulInfo.cellId; + ulTtiReqPdu->pdu.pusch_pdu.nrOfLayers = 1; + ulTtiReqPdu->pdu.pusch_pdu.ulDmrsSymbPos = 4; + ulTtiReqPdu->pdu.pusch_pdu.dmrsConfigType = 0; + ulTtiReqPdu->pdu.pusch_pdu.ulDmrsScramblingId = currUlSlot->ulInfo.cellId; + ulTtiReqPdu->pdu.pusch_pdu.scid = 0; + ulTtiReqPdu->pdu.pusch_pdu.numDmrsCdmGrpsNoData = 1; + ulTtiReqPdu->pdu.pusch_pdu.dmrsPorts = 0; + ulTtiReqPdu->pdu.pusch_pdu.resourceAlloc = \ currUlSlot->ulInfo.schPuschInfo.resAllocType; - ulTtiReqPdu->u.pusch_pdu.rbStart = \ + ulTtiReqPdu->pdu.pusch_pdu.rbStart = \ currUlSlot->ulInfo.schPuschInfo.fdAlloc.startPrb; - ulTtiReqPdu->u.pusch_pdu.rbSize = \ + ulTtiReqPdu->pdu.pusch_pdu.rbSize = \ currUlSlot->ulInfo.schPuschInfo.fdAlloc.numPrb; - ulTtiReqPdu->u.pusch_pdu.vrbToPrbMapping = 0; - ulTtiReqPdu->u.pusch_pdu.frequencyHopping = 0; - ulTtiReqPdu->u.pusch_pdu.txDirectCurrentLocation = 0; - ulTtiReqPdu->u.pusch_pdu.uplinkFrequencyShift7p5khz = 0; - ulTtiReqPdu->u.pusch_pdu.startSymbIndex = \ + ulTtiReqPdu->pdu.pusch_pdu.vrbToPrbMapping = 0; + ulTtiReqPdu->pdu.pusch_pdu.frequencyHopping = 0; + ulTtiReqPdu->pdu.pusch_pdu.txDirectCurrentLocation = 0; + ulTtiReqPdu->pdu.pusch_pdu.uplinkFrequencyShift7p5khz = 0; + ulTtiReqPdu->pdu.pusch_pdu.startSymbIndex = \ currUlSlot->ulInfo.schPuschInfo.tdAlloc.startSymb; - ulTtiReqPdu->u.pusch_pdu.nrOfSymbols = \ + ulTtiReqPdu->pdu.pusch_pdu.nrOfSymbols = \ currUlSlot->ulInfo.schPuschInfo.tdAlloc.numSymb; - ulTtiReqPdu->u.pusch_pdu.puschData.rvIndex = \ + ulTtiReqPdu->pdu.pusch_pdu.mappingType = \ + currUlSlot->ulInfo.schPuschInfo.dmrsMappingType; + ulTtiReqPdu->pdu.pusch_pdu.nrOfDmrsSymbols = \ + currUlSlot->ulInfo.schPuschInfo.nrOfDmrsSymbols; + ulTtiReqPdu->pdu.pusch_pdu.dmrsAddPos = \ + currUlSlot->ulInfo.schPuschInfo.dmrsAddPos; + ulTtiReqPdu->pdu.pusch_pdu.puschData.rvIndex = \ currUlSlot->ulInfo.schPuschInfo.tbInfo.rv; - ulTtiReqPdu->u.pusch_pdu.puschData.harqProcessId = \ + ulTtiReqPdu->pdu.pusch_pdu.puschData.harqProcessId = \ currUlSlot->ulInfo.schPuschInfo.harqProcId; - ulTtiReqPdu->u.pusch_pdu.puschData.newDataIndicator = \ + ulTtiReqPdu->pdu.pusch_pdu.puschData.newDataIndicator = \ currUlSlot->ulInfo.schPuschInfo.tbInfo.ndi; - ulTtiReqPdu->u.pusch_pdu.puschData.tbSize = \ + ulTtiReqPdu->pdu.pusch_pdu.puschData.tbSize = \ currUlSlot->ulInfo.schPuschInfo.tbInfo.tbSize; /* numCb is 0 for new transmission */ - ulTtiReqPdu->u.pusch_pdu.puschData.numCb = 0; + ulTtiReqPdu->pdu.pusch_pdu.puschData.numCb = 0; ulTtiReqPdu->pduSize = sizeof(fapi_ul_pusch_pdu_t); - - SET_MSG_LEN(*msgLen, (sizeof(ulTtiReqPdu->pduType) + \ - sizeof(ulTtiReqPdu->pduSize) + sizeof(fapi_ul_pusch_pdu_t))); } } void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\ - MacUlSlot *currUlSlot, uint32_t *msgLen) + MacUlSlot *currUlSlot) { if(ulTtiReqPdu != NULLP) { ulTtiReqPdu->pduType = PUCCH_PDU_TYPE; - ulTtiReqPdu->u.pucch_pdu.rnti = currUlSlot->ulInfo.schPucchInfo.rnti; + memset(&ulTtiReqPdu->pdu.pucch_pdu, 0, sizeof(fapi_ul_pucch_pdu_t)); + ulTtiReqPdu->pdu.pucch_pdu.rnti = currUlSlot->ulInfo.schPucchInfo.rnti; /* TODO : Fill handle in raCb when scheduling pucch and access here */ - ulTtiReqPdu->u.pucch_pdu.handle = 100; - ulTtiReqPdu->u.pucch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb; - ulTtiReqPdu->u.pucch_pdu.bwpStart = macCellCfg->initialUlBwp.bwp.firstPrb; - ulTtiReqPdu->u.pucch_pdu.subCarrierSpacing = macCellCfg->initialUlBwp.bwp.scs; - ulTtiReqPdu->u.pucch_pdu.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix; - ulTtiReqPdu->u.pucch_pdu.formatType = currUlSlot->ulInfo.schPucchInfo.pucchFormat; /* Supporting PUCCH Format 0 */ - ulTtiReqPdu->u.pucch_pdu.multiSlotTxIndicator = 0; /* No Multi Slot transmission */ - ulTtiReqPdu->u.pucch_pdu.pi2Bpsk = 0; /* Disabled */ - ulTtiReqPdu->u.pucch_pdu.prbStart = currUlSlot->ulInfo.schPucchInfo.fdAlloc.startPrb; - ulTtiReqPdu->u.pucch_pdu.prbSize = currUlSlot->ulInfo.schPucchInfo.fdAlloc.numPrb; - ulTtiReqPdu->u.pucch_pdu.startSymbolIndex = currUlSlot->ulInfo.schPucchInfo.tdAlloc.startSymb; - ulTtiReqPdu->u.pucch_pdu.nrOfSymbols = currUlSlot->ulInfo.schPucchInfo.tdAlloc.numSymb; - ulTtiReqPdu->u.pucch_pdu.freqHopFlag = 0; /* Disabled */ - ulTtiReqPdu->u.pucch_pdu.secondHopPrb = 0; - ulTtiReqPdu->u.pucch_pdu.groupHopFlag = 0; - ulTtiReqPdu->u.pucch_pdu.sequenceHopFlag = 0; - ulTtiReqPdu->u.pucch_pdu.hoppingId = 0; - ulTtiReqPdu->u.pucch_pdu.initialCyclicShift = 0; - ulTtiReqPdu->u.pucch_pdu.dataScramblingId = 0; /* Valid for Format 2, 3, 4 */ - ulTtiReqPdu->u.pucch_pdu.timeDomainOccIdx = 0; /* Valid for Format 1 */ - ulTtiReqPdu->u.pucch_pdu.preDftOccIdx = 0; /* Valid for Format 4 */ - ulTtiReqPdu->u.pucch_pdu.preDftOccLen = 0; /* Valid for Format 4 */ - ulTtiReqPdu->u.pucch_pdu.addDmrsFlag = 0; /* Valid for Format 3, 4 */ - ulTtiReqPdu->u.pucch_pdu.dmrsScramblingId = 0; /* Valid for Format 2 */ - ulTtiReqPdu->u.pucch_pdu.dmrsCyclicShift = 0; /* Valid for Format 4 */ - ulTtiReqPdu->u.pucch_pdu.srFlag = currUlSlot->ulInfo.schPucchInfo.srFlag; - ulTtiReqPdu->u.pucch_pdu.bitLenHarq = currUlSlot->ulInfo.schPucchInfo.numHarqBits; - ulTtiReqPdu->u.pucch_pdu.bitLenCsiPart1 = 0; /* Valid for Format 2, 3, 4 */ - ulTtiReqPdu->u.pucch_pdu.bitLenCsiPart2 = 0; /* Valid for Format 2, 3, 4 */ - ulTtiReqPdu->u.pucch_pdu.beamforming.numPrgs = 0; /* Not Supported */ - ulTtiReqPdu->u.pucch_pdu.beamforming.prgSize = 0; - ulTtiReqPdu->u.pucch_pdu.beamforming.digBfInterfaces = 0; - ulTtiReqPdu->u.pucch_pdu.beamforming.pmi_bfi[0].pmIdx = 0; - ulTtiReqPdu->u.pucch_pdu.beamforming.pmi_bfi[0].beamIdx[0].beamidx = 0; + ulTtiReqPdu->pdu.pucch_pdu.handle = 100; + ulTtiReqPdu->pdu.pucch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb; + ulTtiReqPdu->pdu.pucch_pdu.bwpStart = macCellCfg->initialUlBwp.bwp.firstPrb; + ulTtiReqPdu->pdu.pucch_pdu.subCarrierSpacing = macCellCfg->initialUlBwp.bwp.scs; + ulTtiReqPdu->pdu.pucch_pdu.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix; + ulTtiReqPdu->pdu.pucch_pdu.formatType = currUlSlot->ulInfo.schPucchInfo.pucchFormat; /* Supporting PUCCH Format 0 */ + ulTtiReqPdu->pdu.pucch_pdu.multiSlotTxIndicator = 0; /* No Multi Slot transmission */ + ulTtiReqPdu->pdu.pucch_pdu.pi2Bpsk = 0; /* Disabled */ + ulTtiReqPdu->pdu.pucch_pdu.prbStart = currUlSlot->ulInfo.schPucchInfo.fdAlloc.startPrb; + ulTtiReqPdu->pdu.pucch_pdu.prbSize = currUlSlot->ulInfo.schPucchInfo.fdAlloc.numPrb; + ulTtiReqPdu->pdu.pucch_pdu.startSymbolIndex = currUlSlot->ulInfo.schPucchInfo.tdAlloc.startSymb; + ulTtiReqPdu->pdu.pucch_pdu.nrOfSymbols = currUlSlot->ulInfo.schPucchInfo.tdAlloc.numSymb; + ulTtiReqPdu->pdu.pucch_pdu.freqHopFlag = 0; /* Disabled */ + ulTtiReqPdu->pdu.pucch_pdu.secondHopPrb = 0; + ulTtiReqPdu->pdu.pucch_pdu.groupHopFlag = 0; + ulTtiReqPdu->pdu.pucch_pdu.sequenceHopFlag = 0; + ulTtiReqPdu->pdu.pucch_pdu.hoppingId = 0; + ulTtiReqPdu->pdu.pucch_pdu.initialCyclicShift = 0; + ulTtiReqPdu->pdu.pucch_pdu.dataScramblingId = 0; /* Valid for Format 2, 3, 4 */ + ulTtiReqPdu->pdu.pucch_pdu.timeDomainOccIdx = 0; /* Valid for Format 1 */ + ulTtiReqPdu->pdu.pucch_pdu.preDftOccIdx = 0; /* Valid for Format 4 */ + ulTtiReqPdu->pdu.pucch_pdu.preDftOccLen = 0; /* Valid for Format 4 */ + ulTtiReqPdu->pdu.pucch_pdu.addDmrsFlag = 0; /* Valid for Format 3, 4 */ + ulTtiReqPdu->pdu.pucch_pdu.dmrsScramblingId = 0; /* Valid for Format 2 */ + ulTtiReqPdu->pdu.pucch_pdu.dmrsCyclicShift = 0; /* Valid for Format 4 */ + ulTtiReqPdu->pdu.pucch_pdu.srFlag = currUlSlot->ulInfo.schPucchInfo.srFlag; + ulTtiReqPdu->pdu.pucch_pdu.bitLenHarq = currUlSlot->ulInfo.schPucchInfo.numHarqBits; + ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart1 = 0; /* Valid for Format 2, 3, 4 */ + ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart2 = 0; /* Valid for Format 2, 3, 4 */ + ulTtiReqPdu->pdu.pucch_pdu.beamforming.numPrgs = 0; /* Not Supported */ + ulTtiReqPdu->pdu.pucch_pdu.beamforming.prgSize = 0; + ulTtiReqPdu->pdu.pucch_pdu.beamforming.digBfInterface = 0; + ulTtiReqPdu->pdu.pucch_pdu.beamforming.rx_bfi[0].beamIdx[0].beamidx = 0; ulTtiReqPdu->pduSize = sizeof(fapi_ul_pucch_pdu_t); - SET_MSG_LEN(*msgLen, (sizeof(ulTtiReqPdu->pduType) + \ - sizeof(ulTtiReqPdu->pduSize) + sizeof(fapi_ul_pucch_pdu_t))); } } @@ -3632,7 +3584,6 @@ uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo) { #ifdef INTEL_FAPI uint8_t pduIdx = -1; - uint8_t numPdu = 0; uint32_t msgLen = 0; uint32_t msgSize = 0; @@ -3653,8 +3604,7 @@ uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo) ADD_DELTA_TO_TIME(currTimingInfo,ulTtiReqTimingInfo,PHY_DELTA); currUlSlot = &macCb.macCell->ulSlot[ulTtiReqTimingInfo.slot % MAX_SLOT_SUPPORTED]; - numPdu = getnPdus(NULL, currUlSlot); - msgSize = sizeof(fapi_ul_tti_req_t) + (numPdu*sizeof(fapi_ul_tti_req_pdu_t)); + msgSize = sizeof(fapi_ul_tti_req_t); LWR_MAC_ALLOC(ulTtiReq, msgSize); if(ulTtiReq != NULLP) @@ -3666,46 +3616,32 @@ uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo) ulTtiReq->nGroup = 0; if(ulTtiReq->nPdus > 0) { - ulTtiReq->pdus = (fapi_ul_tti_req_pdu_t *)(ulTtiReq + \ - (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_ul_tti_req_pdu_t*))); /* Fill Prach Pdu */ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH) { pduIdx++; - fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen); + fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot); } /* Fill PUSCH PDU */ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH) { pduIdx++; - fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen); + fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot); } /* Fill PUCCH PDU */ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI) { pduIdx++; - fillPucchPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen); + fillPucchPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot); } - if((currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH) || \ - (currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)|| \ - (currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)) - { - msgLen += (sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t)); - fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen); - - DU_LOG("\nLWR_MAC: Sending UL TTI Request"); - LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq); - } } - else - { - msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t); - fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen); + msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t); + fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen); - DU_LOG("\nLWR_MAC: Sending UL TTI Request"); - LwrMacSendToPhy(ulTtiReq->header.message_type_id, msgSize, (void *)ulTtiReq); - } + DU_LOG("\nLWR_MAC: Sending UL TTI Request"); + LwrMacSendToPhy(ulTtiReq->header.msg_id, msgSize, (void *)ulTtiReq); + memset(currUlSlot, 0, sizeof(MacUlSlot)); return ROK; } diff --git a/src/5gnrmac/lwr_mac_fsm.h b/src/5gnrmac/lwr_mac_fsm.h index b080f9f23..ca7b8d83b 100644 --- a/src/5gnrmac/lwr_mac_fsm.h +++ b/src/5gnrmac/lwr_mac_fsm.h @@ -24,6 +24,12 @@ #define FAPI_UINT_32 4 #define INVALID_VALUE -1 +#define CORESET_TYPE0 0 +#define CORESET_TYPE1 1 +#define CORESET_TYPE2 2 +#define CORESET_TYPE3 3 + + #include "lwr_mac.h" #ifdef INTEL_FAPI diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index cfb819057..87777d694 100644 --- a/src/5gnrmac/lwr_mac_handle_phy.c +++ b/src/5gnrmac/lwr_mac_handle_phy.c @@ -203,7 +203,7 @@ uint8_t handleRachInd(fapi_rach_indication_t *fapiRachInd) for(pduIdx=0; pduIdx < rachInd.numPdu; pduIdx++) { rachPdu = &rachInd.rachPdu[pduIdx]; - rachPdu->pci = fapiRachInd->rachPdu[pduIdx].physCellId; + rachPdu->pci = fapiRachInd->rachPdu[pduIdx].phyCellId; rachPdu->symbolIdx = fapiRachInd->rachPdu[pduIdx].symbolIndex; rachPdu->slotIdx = fapiRachInd->rachPdu[pduIdx].slotIndex; rachPdu->freqIdx = fapiRachInd->rachPdu[pduIdx].freqIndex; @@ -313,7 +313,7 @@ uint8_t handleRxDataInd(fapi_rx_data_indication_t *fapiRxDataInd) pdu->handle = fapiRxDataInd->pdus[pduIdx].handle; pdu->rnti = fapiRxDataInd->pdus[pduIdx].rnti; pdu->harqId = fapiRxDataInd->pdus[pduIdx].harqId; - pdu->pduLength = fapiRxDataInd->pdus[pduIdx].pduLength; + pdu->pduLength = fapiRxDataInd->pdus[pduIdx].pdu_length; pdu->ul_cqi = fapiRxDataInd->pdus[pduIdx].ul_cqi; pdu->timingAdvance = fapiRxDataInd->pdus[pduIdx].timingAdvance; pdu->rssi = fapiRxDataInd->pdus[pduIdx].rssi; @@ -338,7 +338,7 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) fapi_msg_t *header; header = (fapi_msg_t *)msg; - switch(header->message_type_id) + switch(header->msg_id) { case FAPI_PARAM_RESPONSE: case FAPI_CONFIG_RESPONSE: diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 269ae0b12..6ca3e4769 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -545,6 +545,10 @@ uint8_t offsetPointA pdsch->dmrs.scid = 0; pdsch->dmrs.numDmrsCdmGrpsNoData = 1; pdsch->dmrs.dmrsPorts = 0; + pdsch->dmrs.mappingType = DMRS_MAP_TYPE_A; /* Type-A */ + pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; + pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS; + pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */ pdsch->pdschFreqAlloc.freqAlloc.startPrb = offset + SCH_SSB_NUM_PRB; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 3090cbda6..4c4f2b782 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -41,6 +41,9 @@ #define PUCCH_NUM_PRB_FORMAT_0 1 /* number of PRBs in freq domain, spec 38.213 - 9.2.1 */ #define SI_RNTI 0xFFFF #define P_RNTI 0xFFFE +#define DMRS_MAP_TYPE_A 1 +#define NUM_DMRS_SYMBOLS 12 +#define DMRS_ADDITIONAL_POS 2 #define CRC_FAILED 0 #define CRC_PASSED 1 diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index a8bb0b75a..ae61c2ca1 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -428,6 +428,9 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot) pdsch->dmrs.scid = 0; pdsch->dmrs.numDmrsCdmGrpsNoData = 1; pdsch->dmrs.dmrsPorts = 0; + pdsch->dmrs.mappingType = DMRS_MAP_TYPE_A; /* Setting to Type-A */ + pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; + pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS; pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */ /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ pdsch->pdschFreqAlloc.freqAlloc.startPrb = offset + SCH_SSB_NUM_PRB; diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index de1a8555a..f4c7a64c2 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -160,6 +160,9 @@ uint8_t *msg3NumRb) schUlSlotInfo->schPuschInfo->tbInfo.ndi = 1; /* new transmission */ schUlSlotInfo->schPuschInfo->tbInfo.rv = 0; schUlSlotInfo->schPuschInfo->tbInfo.tbSize = 24; /*Considering 2 PRBs */ + schUlSlotInfo->schPuschInfo->dmrsMappingType = DMRS_MAP_TYPE_A; /* Setting Type-A */ + schUlSlotInfo->schPuschInfo->nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; + schUlSlotInfo->schPuschInfo->dmrsAddPos = DMRS_ADDITIONAL_POS; *msg3StartRb = startRb; *msg3NumRb = numRb; @@ -340,6 +343,9 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of pdsch->dmrs.scid = 0; pdsch->dmrs.numDmrsCdmGrpsNoData = 1; pdsch->dmrs.dmrsPorts = 0; + pdsch->dmrs.mappingType = DMRS_MAP_TYPE_A; /* Type-A */ + pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; + pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS; pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */ pdsch->pdschFreqAlloc.freqAlloc.startPrb = offset + SCH_SSB_NUM_PRB; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ pdsch->pdschFreqAlloc.freqAlloc.numPrb = schCalcNumPrb(tbSize,mcs,numPdschSymbols); diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index 8a5f298db..00a82a954 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -33,6 +33,14 @@ */ /* header files */ +#include "common_def.h" +#include "du_app_mac_inf.h" +#include "lrg.h" +#include "tfu.h" +#include "tfu.x" /* TFU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "mac_sch_interface.h" +#include "sch.h" #include "sch_utils.h" #include "math.h" @@ -555,7 +563,6 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols) uint8_t qm = mcsTable[mcs][1]; uint16_t rValue = mcsTable[mcs][2]; uint8_t numLayer = 1; /* v value */ - uint8_t numDmrsSymbols = 12; /* considering whole of one symbols with 12 SCs for DMRS */ /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 * * Ninfo = Nre . R . Qm . v * @@ -564,7 +571,7 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols) nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer)); - nreDash = ceil( (12 * numSymbols) - numDmrsSymbols - 0); + nreDash = ceil( (12 * numSymbols) - NUM_DMRS_SYMBOLS - 0); if (nreDash > 156) nre = 156; diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 1272f68ef..daf881519 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -139,6 +139,9 @@ typedef struct dmrsInfo uint8_t scid; uint8_t numDmrsCdmGrpsNoData; uint16_t dmrsPorts; + uint8_t mappingType; + uint8_t nrOfDmrsSymbols; + uint8_t dmrsAddPos; } DmrsInfo; typedef struct pdschFreqAlloc @@ -470,6 +473,9 @@ typedef struct schPuschInfo FreqDomainAlloc fdAlloc; /* Freq domain allocation */ TimeDomainAlloc tdAlloc; /* Time domain allocation */ TbInfo tbInfo; /* TB info */ + uint8_t dmrsMappingType; + uint8_t nrOfDmrsSymbols; + uint8_t dmrsAddPos; }SchPuschInfo; typedef struct schPucchInfo diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index c73cef20c..12a967217 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -24,9 +24,9 @@ #include "lkw.x" #include "du_cfg.h" #include "E2AP-PDU.h" -#include "du_cell_mgr.h" #include #include "F1AP-PDU.h" +#include "du_cell_mgr.h" extern DuCfgParams duCfgParam; extern S16 duBuildAndSendMacCellCfg(); @@ -113,9 +113,9 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) * RFAILED - failure * * ****************************************************************/ -S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg) +uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg) { - S16 ret = ROK; + uint8_t ret = ROK; F1SetupResponse_t *f1SetRspMsg; F1SetupRsp f1SetRspDb; diff --git a/src/du_app/du_cell_mgr.h b/src/du_app/du_cell_mgr.h index 281f617f2..37027b758 100644 --- a/src/du_app/du_cell_mgr.h +++ b/src/du_app/du_cell_mgr.h @@ -28,6 +28,7 @@ S16 duSendSchGnbCfg(); S16 duSendSchGnbCfgToMac(RgrCfgReqInfo *cfgReq, U32 trans_id); +uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg); #endif /********************************************************************** End of file diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 0f542889c..07686eef7 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -26,7 +26,6 @@ #include "E2AP-PDU.h" #include "du_mgr.h" #include "du_mgr_main.h" -#include "du_cell_mgr.h" #include "du_f1ap_msg_hdl.h" #include "GNB-DU-System-Information.h" #include "CellGroupConfigRrc.h" @@ -69,6 +68,7 @@ #include #include "ProtocolExtensionField.h" #include "F1AP-PDU.h" +#include "du_cell_mgr.h" S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg); uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg); diff --git a/src/phy_stub/l1_bdy1.c b/src/phy_stub/l1_bdy1.c index f357ddd3a..555c2b0b4 100644 --- a/src/phy_stub/l1_bdy1.c +++ b/src/phy_stub/l1_bdy1.c @@ -151,7 +151,7 @@ S16 l1BldAndSndParamRsp(void *msg) 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); + handlePhyMessages(fapiParamRsp->header.msg_id, sizeof(fapi_param_resp_t), (void *)fapiParamRsp); MAC_FREE(fapiParamRsp, sizeof(fapi_param_resp_t)); #endif return ROK; @@ -186,16 +186,16 @@ S16 l1BldAndSndConfigRsp(void *msg) DU_LOG("PHY STUB: Memory allocation failed"); return RFAILED; } - + memset(fapiConfigRsp, 0, sizeof(fapi_config_resp_t)); 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); + msgLen = sizeof(fapi_config_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, \ + handlePhyMessages(fapiConfigRsp->header.msg_id, \ sizeof(fapi_config_resp_t), (void *)fapiConfigRsp); MAC_FREE(fapiConfigRsp, sizeof(fapi_config_resp_t)); #endif @@ -298,6 +298,7 @@ uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn) printf("\nPHY_STUB: Memory allocation failed for CRC Indication Message"); return RFAILED; } + memset(crcInd, 0, sizeof(fapi_crc_ind_t)); /* TODO: Fill the required values. As of now only 1 CRC status PASS is filled */ crcInd->sfn = sfn; @@ -315,11 +316,11 @@ uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn) crcInd->crc[idx].rssi = 0; fillMsgHeader(&crcInd->header, FAPI_CRC_INDICATION, \ - sizeof(fapi_crc_ind_t)); + sizeof(fapi_crc_ind_t) - sizeof(fapi_msg_t)); /* Sending RACH indication to MAC */ DU_LOG("\nPHY STUB: Sending CRC Indication to MAC"); - handlePhyMessages(crcInd->header.message_type_id, sizeof(fapi_crc_ind_t), (void *)crcInd); + handlePhyMessages(crcInd->header.msg_id, sizeof(fapi_crc_ind_t), (void *)crcInd); MAC_FREE(crcInd, sizeof(fapi_crc_ind_t)); #endif return ROK; @@ -350,6 +351,7 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_ fapi_pdu_ind_info_t *pduInfo; uint8_t *pdu; uint16_t byteIdx = 0; + uint32_t msgLen = 0; MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t)); if(!rxDataInd) @@ -357,8 +359,10 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_ printf("\nPHY_STUB: Memory allocation failed for Rx Data Indication"); return RFAILED; } + memset(rxDataInd, 0, sizeof(fapi_rx_data_indication_t)); /* TODO: Fill the required values */ + msgLen = sizeof(fapi_rx_data_indication_t) - sizeof(fapi_msg_t); rxDataInd->sfn = sfn; rxDataInd->slot = slot; rxDataInd->numPdus = 1; @@ -367,14 +371,14 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_ pduInfo->handle = puschPdu.handle; pduInfo->rnti = puschPdu.rnti; pduInfo->harqId = puschPdu.puschData.harqProcessId; - pduInfo->pduLength = puschPdu.puschData.tbSize; + pduInfo->pdu_length = puschPdu.puschData.tbSize; pduInfo->ul_cqi = 0; pduInfo->timingAdvance = 0; pduInfo->rssi = 0; /* Filling pdu with random values for testing */ pduInfo->pduData = NULL; - MAC_ALLOC(pduInfo->pduData, pduInfo->pduLength); + MAC_ALLOC(pduInfo->pduData, pduInfo->pdu_length); if(!pduInfo->pduData) { printf("\nPHY_STUB: Memory allocation failed for Rx Data Pdu"); @@ -394,18 +398,18 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_ /* Harcoding the pad bytes */ pdu[byteIdx++] = 63; - for(; byteIdx < pduInfo->pduLength; byteIdx++) + for(; byteIdx < pduInfo->pdu_length; byteIdx++) pdu[byteIdx] = 0; + msgLen += pduInfo->pdu_length; - fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, \ - sizeof(fapi_rx_data_indication_t)); + fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen); /* Sending Rx data indication to MAC */ DU_LOG("\nPHY STUB: Sending Rx data Indication to MAC"); - handlePhyMessages(rxDataInd->header.message_type_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd); + handlePhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd); - if(pduInfo->pduLength) - MAC_FREE(pduInfo->pduData, pduInfo->pduLength); + if(pduInfo->pdu_length) + MAC_FREE(pduInfo->pduData, pduInfo->pdu_length); MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t)); return ROK; } @@ -443,13 +447,13 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn) printf("\nPHY_STUB: Memory allocation failed for Rach Indication Message"); return RFAILED; } - + memset(rachInd, 0, sizeof(fapi_rach_indication_t)); rachInd->sfn = sfn; rachInd->slot = slot; rachInd->numPdus = 1; rachPdu = &rachInd->rachPdu[rachPduIdx]; - rachPdu->physCellId = NR_PCI; + rachPdu->phyCellId = NR_PCI; rachPdu->symbolIndex = 0; rachPdu->slotIndex = slot; rachPdu->freqIndex = 0; @@ -459,14 +463,14 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn) rachPdu->preambleInfo[preamIdx].preambleIndex = 3; rachPdu->preambleInfo[preamIdx].timingAdvance = 0; - rachPdu->preambleInfo[preamIdx].premblePwr = 0; + rachPdu->preambleInfo[preamIdx].preamblePwr = 0; fillMsgHeader(&rachInd->header, FAPI_RACH_INDICATION, \ - sizeof(fapi_rach_indication_t)); + sizeof(fapi_rach_indication_t) - sizeof(fapi_msg_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); + handlePhyMessages(rachInd->header.msg_id, sizeof(fapi_rach_indication_t), (void *)rachInd); MAC_FREE(rachInd, sizeof(fapi_rach_indication_t)); #endif return ROK; @@ -502,6 +506,7 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication() } else { + memset(slotIndMsg, 0, sizeof(fapi_slot_ind_t)); slotIndMsg->sfn = sfnValue; slotIndMsg->slot = slotValue; DU_LOG("\n\nPHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue); @@ -518,8 +523,9 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication() sfnValue++; slotValue = 0; } - fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, sizeof(fapi_slot_ind_t)); - handlePhyMessages(slotIndMsg->header.message_type_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg); + fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, \ + sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t)); + handlePhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg); MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t)); } #endif @@ -696,7 +702,7 @@ PUBLIC S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg) { DU_LOG("\nPHY STUB: PUSCH PDU"); l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \ - ulTtiReq->pdus[numPdus-1].u.pusch_pdu); + ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu); } if(ulTtiReq->pdus[numPdus-1].pduType == 2) { @@ -747,7 +753,7 @@ PUBLIC uint16_t l1BuildAndSendStopInd() { fillMsgHeader(&stopIndMsg->header, FAPI_STOP_INDICATION, msgLen); DU_LOG("\n\nPHY_STUB: Processing Stop indication to MAC"); - handlePhyMessages(stopIndMsg->header.message_type_id,\ + handlePhyMessages(stopIndMsg->header.msg_id,\ sizeof(fapi_stop_ind_t), (void*)stopIndMsg); MAC_FREE(stopIndMsg, sizeof(fapi_stop_ind_t)); } -- 2.16.6