#define SSB_PDU_TYPE 3
#define PRACH_PDU_TYPE 0
#define PUSCH_PDU_TYPE 1
+#define PUCCH_PDU_TYPE 2
#define PDU_PRESENT 1
#define SET_MSG_LEN(x, size) x += size
}
if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH_UCI)
{
- pduCount++;
- ulTtiReq->nUlsch++;
- 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 = PDU_PRESENT;
+ }
+ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
+ {
+ pduCount++;
+ ulTtiReq->nUlcch = PDU_PRESENT;
+ }
+ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS)
+ {
+ pduCount++;
+ }
+ }
return pduCount;
}
#endif
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)
+{
+ if(ulTtiReqPdu != NULLP)
+ {
+ ulTtiReqPdu->pduType = PUCCH_PDU_TYPE;
+ ulTtiReqPdu->u.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->pduSize = sizeof(fapi_ul_pucch_pdu_t);
+ SET_MSG_LEN(*msgLen, (sizeof(ulTtiReqPdu->pduType) + \
+ sizeof(ulTtiReqPdu->pduSize) + sizeof(fapi_ul_pucch_pdu_t)));
+ }
+}
+
#endif
/*******************************************************************
if(ulTtiReq != NULLP)
{
memset(ulTtiReq, 0, msgSize);
- ulTtiReq->sfn = currTimingInfo.sfn;
- ulTtiReq->slot = currTimingInfo.slot;
+ ulTtiReq->sfn = ulTtiReqTimingInfo.sfn;
+ ulTtiReq->slot = ulTtiReqTimingInfo.slot;
ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot);
ulTtiReq->nGroup = 0;
if(ulTtiReq->nPdus > 0)
pduIdx++;
fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
}
-
+ /* Fill PUCCH PDU */
+ if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
+ {
+ pduIdx++;
+ fillPucchPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot, &msgLen);
+ }
if((currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH) || \
- (currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH))
+ (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);
}
- memset(&currUlSlot, 0, sizeof(MacUlSlot));
+ memset(currUlSlot, 0, sizeof(MacUlSlot));
return ROK;
}
else
{
DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
- memset(&currUlSlot, 0, sizeof(MacUlSlot));
+ memset(currUlSlot, 0, sizeof(MacUlSlot));
return RFAILED;
}
}
Pst cfmPst;
uint16_t ret = ROK;
RgCellCb *cellCb;
- MacCellCb *macCellCb;
+ MacCellCb *macCellCb = NULLP;
Inst inst = pst->dstInst;
cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
return RFAILED;
}
+ memset(macCellCb, 0, sizeof(MacCellCb));
macCb.macCell = macCellCb;
macCb.macCell->cellId = macCellCfg->cellId;
/* Send cell cfg to scheduler */
#include "ss_rbuf.x"
#endif
+uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo);
+uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo);
+
/* ADD Changes for Downlink UE Timing Optimization */
#ifndef LTEMAC_DLUE_TMGOPTMZ
PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb,
#define MSG4_DELAY 1
#define SCH_MAX_UE 1
#define PUSCH_START_RB 15
+#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
uint16_t assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
bool puschPres; /*!< PUSCH presence field */
SchPuschInfo *schPuschInfo; /*!< PUSCH info */
+ bool pucchPres; /*!< PUCCH presence field */
+ SchPucchInfo schPucchInfo; /*!< PUCCH info */
}SchUlSlotInfo;
/**
uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst inst);
uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst);
uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot);
-
-
+uint16_t schCalcTbSize(uint16_t payLoadSize);
+uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols);
+uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot);
/**********************************************************************
End of file
**********************************************************************/
extern SchCb schCb[SCH_MAX_INST];
extern uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8];
extern uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5];
+extern uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4];
SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
{
}
}
+uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
+{
+ /* derive pucchResourceSet from schCellCfg */
+ SchCellCb *cell = schCb[inst].cells[inst];
+ SchPucchCfgCmn *pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
+ uint8_t pucchIdx = pucchCfg->pucchResourceCommon;
+ SchBwpParams *ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
+
+ schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
+ schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0;
+ schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1];
+ schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2];
+ schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
+
+ /* set HARQ flag to true */
+ schPucchInfo->harqFlag = true;
+ schPucchInfo->numHarqBits = 1; /* 1 bit for HARQ */
+
+ /* set SR and UCI flag to false */
+ schPucchInfo->srFlag = false;
+ schPucchInfo->uciFlag = false;
+
+ return ROK;
+}
+
/**
* @brief resource allocation for UL
*
{
int ret = ROK;
UlSchedInfo ulSchedInfo;
- SchUlSlotInfo *schUlSlotInfo;
+ SchUlSlotInfo *schUlSlotInfo = NULLP;
SlotIndInfo ulTimingInfo;
+ memset(&ulSchedInfo, 0, sizeof(UlSchedInfo));
/* add PHY delta */
ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA+SCHED_DELTA);
schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot];
-
if(schUlSlotInfo->schPuschInfo)
{
ulSchedInfo.crnti = cell->raCb[0].tcrnti;
schUlSlotInfo->schPuschInfo = NULL;
}
+ if(schUlSlotInfo->pucchPres)
+ {
+ ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
+ fillPucchResourceInfo(&schUlSlotInfo->schPucchInfo, schInst);
+ memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
+ sizeof(SchPucchInfo));
+ memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+ }
+
//send msg to MAC
ret = sendUlSchInfoToMac(&ulSchedInfo, schInst);
if(ret != ROK)
{
DU_LOG("\nSending UL Sch info from SCH to MAC failed");
}
-
memset(cell->schUlSlotInfo[ulTimingInfo.slot], 0, sizeof(SchUlSlotInfo));
return ret;
return ROK;
}
+uint16_t schAllocPucchResource(SchCellCb *cell,uint16_t crnti, uint16_t slot)
+{
+ uint8_t k1 = 1; /* dl-DataToUL-ACK RRC parameter will received from DU-APP msg4-pucch config */
+ uint16_t pucchSlot = (slot + k1) % SCH_NUM_SLOTS;
+ SchUlSlotInfo *schUlSlotInfo = NULLP;
+
+ schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
+ memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+
+ schUlSlotInfo->pucchPres = true;
+ schUlSlotInfo->schPucchInfo.rnti = crnti;
+
+ return ROK;
+}
+
/**********************************************************************
End of file
**********************************************************************/
sizeof(Msg4Info));
/* pdcch and pdsch data is filled */
- schDlRsrcAllocMsg4(msg4Alloc, cell, slot);
- SCH_FREE(cell->schDlSlotInfo[slot]->msg4Info, sizeof(Msg4Info));
- cell->schDlSlotInfo[slot]->msg4Info = NULL;
+ schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot);
+
+ /* PUCCH resource */
+ schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot);
+
+ SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info));
+ cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL;
}
{ 30, 4, 0}, /* mcs index 30 */
{ 31, 6, 0}}; /* mcs index 31 */
+/* PUCCH resource sets before dedicated PUCCH resource configuration */
+/* Table 9.2.1-1 spec 38.213 */
+uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = {
+{ 0, 12, 2, 0 }, /* index 0 */
+{ 0, 12, 2, 0 }, /* index 1 */
+{ 0, 12, 2, 3 }, /* index 2 */
+{ 1, 10, 4, 0 }, /* index 3 */
+{ 1, 10, 4, 0 }, /* index 4 */
+{ 1, 10, 4, 2 }, /* index 5 */
+{ 1, 10, 4, 4 }, /* index 6 */
+{ 1, 4, 10, 0 }, /* index 7 */
+{ 1, 4, 10, 0 }, /* index 8 */
+{ 1, 4, 10, 2 }, /* index 9 */
+{ 1, 4, 10, 4 }, /* index 10 */
+{ 1, 0, 14, 0 }, /* index 11 */
+{ 1, 0, 14, 0 }, /* index 12 */
+{ 1, 0, 14, 2 }, /* index 13 */
+{ 1, 0, 14, 4 }, /* index 14 */
+{ 1, 0, 14, 0 }, /* index 15 */
+};
+
/**
* @brief frequency domain allocation function.
*
*******************************************************************************/
#include <stdint.h>
+#include <math.h>
/* macros */
#define MAX_CORESET_INDEX 16
#define MAX_SEARCH_SPACE_INDEX 16
#define MAX_RACH_NUM_RB_IDX 16
+#define MAX_PUCCH_RES_SET_IDX 16
#define MAX_PRACH_CONFIG_IDX 256
#define MAX_MU_PUSCH 4
#define TOTAL_TBSIZE_VALUES 93
uint8_t lengthSymbol;
}PdschConfigCommon;
+typedef struct pucchConfigCommon
+{
+ uint8_t pucchResourceCommon;
+ uint8_t pucchGroupHopping;
+}PucchConfigCommon;
+
typedef struct puschConfigCommon
{
/* PUSCH-TimeDomainResourceAllocation info */
{
BwpParams bwp;
// rach config common sent in PrachCfg
- // pucch info not required
+ PucchConfigCommon pucchCommon;
PuschConfigCommon puschCommon;
}BwpUlConfig;
uint8_t lengthSymbol;
}SchPdschCfgCmn;
+typedef struct schPucchCfgCmn
+{
+ uint8_t pucchResourceCommon;
+ uint8_t pucchGroupHopping;
+}SchPucchCfgCmn;
+
typedef struct schPuschCfgCmn
{
uint8_t k2;
typedef struct schBwpUlCfg
{
SchBwpParams bwp;
+ SchPucchCfgCmn pucchCommon;
SchPuschCfgCmn puschCommon;
}SchBwpUlCfg;
typedef struct msg4Info
{
+ uint16_t crnti;
uint8_t ndi;
uint8_t harqProcNum;
uint8_t dlAssignIdx;
uint8_t pucchResInd;
uint8_t harqFeedbackInd;
uint8_t dciFormatId;
- uint16_t crnti;
uint8_t *msg4Pdu;
uint16_t msg4PduLen;
}Msg4Info;
TbInfo tbInfo; /* TB info */
}SchPuschInfo;
+typedef struct schPucchInfo
+{
+ uint16_t rnti;
+ uint8_t pucchFormat;
+ FreqDomainAlloc fdAlloc; /* Freq domain allocation */
+ TimeDomainAlloc tdAlloc; /* Time domain allocation */
+ uint8_t srFlag;
+ uint8_t harqFlag;
+ uint8_t numHarqBits;
+ uint8_t uciFlag;
+ uint8_t numUciBits;
+}SchPucchInfo;
typedef struct ulSchedInfo
{
uint8_t dataType; /* Type of info being scheduled */
PrachSchInfo prachSchInfo; /* Prach scheduling info */
SchPuschInfo schPuschInfo; /* Pusch scheduling info */
+ SchPucchInfo schPucchInfo; /* Pusch scheduling info */
}UlSchedInfo;
typedef struct rachIndInfo
PDSCH_LENGTH_SYMBOL;
/* ra-searchSpace ID is set to 1 */
duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
+
/* fill Intial UL BWP */
duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */
PUSCH_LENGTH_SYMBOL;
duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
+ /* fill PUCCH config common */
+ duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
+ duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
/* This should be calculated based on
(number of mandatory parameters) + (number of otional parameters being filled) */
/* Macro define for PUCCH Configuration */
#define PUCCH_RSRC_COMMON 0
+#define PUCCH_GROUP_HOPPING 2 /* disable */
#define PUCCH_P0_NOMINAL -74
/* MACRO defines for TDD DL-UL Configuration */
while(numPdus)
{
if(ulTtiReq->pdus[numPdus-1].pduType == 0)
+ {
DU_LOG("\nPHY STUB: PRACH PDU");
+ }
if(ulTtiReq->pdus[numPdus-1].pduType == 1)
{
DU_LOG("\nPHY STUB: PUSCH PDU");
l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
ulTtiReq->pdus[numPdus-1].u.pusch_pdu);
}
+ if(ulTtiReq->pdus[numPdus-1].pduType == 2)
+ {
+ DU_LOG("\nPHY STUB: PUCCH PDU");
+ }
numPdus--;
}