From 134974ec70ab6e0501889e5d162a3b0c806c3bdc Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Tue, 2 Jun 2020 15:01:46 +0530 Subject: [PATCH] DL Resource allocation for msg4 Change-Id: I80590c83d016afcb8802ea02800a11e955cf0e67 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac_upr_inf.h | 6 ++ src/5gnrmac/mac_msg_hdl.c | 60 +++++++++++++++++-- src/5gnrmac/mac_slot_ind.c | 9 +++ src/5gnrsch/sch.c | 55 ++++++++++++++++- src/5gnrsch/sch.h | 4 +- src/5gnrsch/sch_common.c | 135 ++++++++++++++++++++++++++++++++++++++++++ src/5gnrsch/sch_rach.c | 4 +- src/5gnrsch/sch_slot_ind.c | 26 ++++++++ src/5gnrsch/sch_utils.c | 4 +- src/5gnrsch/sch_utils.h | 5 +- src/cm/mac_sch_interface.c | 29 +++++++++ src/cm/mac_sch_interface.h | 50 +++++++++++++++- src/cm/tfu.h | 6 -- 13 files changed, 371 insertions(+), 22 deletions(-) diff --git a/src/5gnrmac/lwr_mac_upr_inf.h b/src/5gnrmac/lwr_mac_upr_inf.h index 9ed2b7d41..1fbbd5710 100644 --- a/src/5gnrmac/lwr_mac_upr_inf.h +++ b/src/5gnrmac/lwr_mac_upr_inf.h @@ -46,6 +46,12 @@ #include "cm_lte.x" /* common tokens */ #include "tfu.x" +/* events */ +#define EVENT_RACH_IND_TO_MAC 0 +#define EVENT_CRC_IND_TO_MAC 1 +#define EVENT_RX_DATA_IND_TO_MAC 2 +#define EVENT_STOP_IND_TO_MAC 3 + typedef S16 (*packSlotIndMsg)(Pst *pst, SlotIndInfo *slotInd); S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd); S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd); diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index b9df6b078..62d8f9c5c 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -74,6 +74,40 @@ MacSchCrcIndFunc macSchCrcIndOpts[]= packMacSchCrcInd }; +/* Function pointer for sending DL RLC BO Info from MAC to SCH */ +MacSchDlRlcBoInfoFunc macSchDlRlcBoInfoOpts[]= +{ + packMacSchDlRlcBoInfo, + macSchDlRlcBoInfo, + packMacSchDlRlcBoInfo +}; + +/******************************************************************* + * + * @brief Sends DL BO Info to SCH + * + * @details + * + * Function : sendDlRlcBoInfoMacToSch + * + * Functionality: + * Sends DL BO Info to SCH + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + ****************************************************************/ +int sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo) +{ + Pst pst; + + fillMacToSchPst(&pst); + pst.event = EVENT_DL_RLC_BO_INFO_TO_SCH; + + return(*macSchDlRlcBoInfoOpts[pst.selector])(&pst, dlBoInfo); +} + /******************************************************************* * * @brief Sends CRC Indication to SCH @@ -285,9 +319,30 @@ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) * ****************************************************************/ uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo) { + DlRlcBOInfo dlBoInfo; + DU_LOG("\nMAC : Handling DL CCCH IND"); - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchIndInfo->dlCcchMsg)); + /* TODO : Fill DL RLC Buffer status info */ + dlBoInfo.cellId = dlCcchIndInfo->cellId; + dlBoInfo.crnti = dlCcchIndInfo->crnti; + dlBoInfo.numLc = 0; + + if(dlCcchIndInfo->msgType == RRC_SETUP) + { + dlBoInfo.numLc++; + dlBoInfo.boInfo[dlBoInfo.numLc].lcId = 0; // SRB 0 for msg4 + dlBoInfo.boInfo[dlBoInfo.numLc].dataVolume = \ + strlen((const char*)dlCcchIndInfo->dlCcchMsg); + } + + /* TODO: Store dlCcchMsg in raCb */ + + sendDlRlcBoInfoMacToSch(&dlBoInfo); + + + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, \ + strlen((const char*)dlCcchIndInfo->dlCcchMsg)); MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo, sizeof(DlCcchIndInfo)); return ROK; @@ -353,9 +408,6 @@ uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti return ret; } - - - /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 12cdaa10e..7ddafb72d 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -85,6 +85,15 @@ int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc) MacDlSlot *currDlSlot = &macCb.macCell->dlSlot[dlAlloc->slotIndInfo.slot % MAX_SLOT_SUPPORTED]; memcpy(&currDlSlot->dlInfo, dlAlloc, sizeof(DlAlloc)); + + if(currDlSlot->dlInfo.msg4Alloc) + { + /* TODO: + * Step1 : Fetch msg4 from raCb that was filled in MacHdlDlCcchInd() + * Step2 : Mux msg4 + * Step3 : Store the pdu in raCb + */ + } } return ROK; } diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 15b720c26..aa937129c 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -66,8 +66,6 @@ #include "sch_utils.h" #include "du_log.h" extern SchCb schCb[SCH_MAX_INST]; -extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4]; -extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm); /* local defines */ SchCellCfgCfmFunc SchCellCfgCfmOpts[] = @@ -496,7 +494,7 @@ uint8_t offsetPointA sib1SchCfg->n0 = slotIndex; /* calculate the PRBs */ - freqDomResourceAlloc( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); + calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); /* fill the PDCCH PDU */ pdcch->pdcchBwpCfg.BWPSize = MAX_NUM_RB; /* whole of BW */ @@ -629,6 +627,57 @@ SchCellCfg *schCellCfg } +/******************************************************************* + * + * @brief Processes DL RLC BO info from MAC + * + * @details + * + * Function : macSchDlRlcBoInfo + * + * Functionality: + * Processes DL RLC BO info from MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo) +{ + uint16_t lcIdx; + Inst inst = pst->dstInst-SCH_INST_START; + DU_LOG("\nSCH : Received RLC BO Status indication"); + + SchCellCb *cell = schCb[inst].cells[inst]; + SchDlAlloc *dlAlloc = \ + cell->dlAlloc[(cell->slotInfo.slot + SCHED_DELTA) % SCH_NUM_SLOTS]; + + for(lcIdx = 0; lcIdx < dlBoInfo->numLc; lcIdx++) + { + if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID) + { + SCH_ALLOC(dlAlloc->msg4Info, sizeof(Msg4Info)); + if(!dlAlloc->msg4Info) + { + DU_LOG("\nSCH : Memory allocation failed for msg4Info"); + dlAlloc = NULL; + return RFAILED; + } + dlAlloc->msg4Info->crnti = dlBoInfo->crnti; + dlAlloc->msg4Info->ndi = 1; + dlAlloc->msg4Info->harqProcNum = 0; + dlAlloc->msg4Info->dlAssignIdx = 0; + dlAlloc->msg4Info->pucchTpc = 0; + dlAlloc->msg4Info->pucchResInd = 0; + dlAlloc->msg4Info->harqFeedbackInd = 0; + dlAlloc->msg4Info->dciFormatId = 1; + } + } + + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index ab2989d47..efc785179 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -60,7 +60,6 @@ SPutSBuf(SCH_MEM_REGION, SCH_POOL, \ (Data *)_datPtr, _size); - #define SCH_FILL_RSP_PST(_rspPst, _inst)\ { \ _rspPst.srcProcId = SFndProcId(); \ @@ -102,6 +101,7 @@ typedef struct schDlAlloc bool sib1Pres; bool rarPres; RarInfo rarInfo; + Msg4Info *msg4Info; }SchDlAlloc; typedef struct schRaCb @@ -156,7 +156,7 @@ SchCb schCb[SCH_MAX_INST]; uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,uint16_t slot); uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst inst); uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst); - +uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot); /********************************************************************** diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 8b866b792..6c00b57e9 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -329,6 +329,141 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) return ret; } + +/******************************************************************* + * + * @brief Fills pdcch and pdsch info for msg4 + * + * @details + * + * Function : schDlRsrcAllocMsg4 + * + * Functionality: + * Fills pdcch and pdsch info for msg4 + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot) +{ + uint8_t coreset0Idx = 0; + uint8_t numRbs = 0; + uint8_t firstSymbol = 0; + uint8_t numSymbols = 0; + uint8_t offset = 0; + uint8_t offsetPointA; + uint8_t FreqDomainResource[6] = {0}; + SchBwpDlCfg *initialBwp; + + PdcchCfg *pdcch = &msg4Alloc->msg4PdcchCfg; + PdschCfg *pdsch = &msg4Alloc->msg4PdschCfg; + + initialBwp = &cell->cellCfg.schInitialDlBwp; + offsetPointA = cell->cellCfg.ssbSchCfg.ssbOffsetPointA; + coreset0Idx = initialBwp->pdcchCommon.raSearchSpace.coresetId; + + /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */ + numRbs = coresetIdxTable[coreset0Idx][1]; + numSymbols = coresetIdxTable[coreset0Idx][2]; + offset = coresetIdxTable[coreset0Idx][3]; + + /* calculate time domain parameters */ + uint16_t mask = 0x2000; + for(firstSymbol=0; firstSymbol<14;firstSymbol++) + { + if(initialBwp->pdcchCommon.raSearchSpace.monitoringSymbol & mask) + break; + else + mask = mask>>1; + } + + /* calculate the PRBs */ + calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); + + /* fill the PDCCH PDU */ + pdcch->pdcchBwpCfg.BWPSize = initialBwp->bwp.numPrb; + pdcch->pdcchBwpCfg.BWPStart = initialBwp->bwp.firstPrb; + pdcch->pdcchBwpCfg.subcarrierSpacing = initialBwp->bwp.scs; + pdcch->pdcchBwpCfg.cyclicPrefix = initialBwp->bwp.cyclicPrefix; + pdcch->coreset0Cfg.startSymbolIndex = firstSymbol; + pdcch->coreset0Cfg.durationSymbols = numSymbols; + memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6); + pdcch->coreset0Cfg.cceRegMappingType = 1; /* coreset0 is always interleaved */ + pdcch->coreset0Cfg.regBundleSize = 6; /* spec-38.211 sec 7.3.2.2 */ + pdcch->coreset0Cfg.interleaverSize = 2; /* spec-38.211 sec 7.3.2.2 */ + pdcch->coreset0Cfg.coreSetType = 0; + pdcch->coreset0Cfg.coreSet0Size = numRbs; + pdcch->coreset0Cfg.shiftIndex = cell->cellCfg.phyCellId; + pdcch->coreset0Cfg.precoderGranularity = 0; /* sameAsRegBundle */ + pdcch->numDlDci = 1; + pdcch->dci.rnti = cell->dlAlloc[slot]->msg4Info->crnti; + pdcch->dci.scramblingId = cell->cellCfg.phyCellId; + pdcch->dci.scramblingRnti = 0; + pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ + pdcch->dci.aggregLevel = 4; + pdcch->dci.beamPdcchInfo.numPrgs = 1; + pdcch->dci.beamPdcchInfo.prgSize = 1; + pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci.txPdcchPower.powerValue = 0; + pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; + + /* fill the PDSCH PDU */ + uint8_t cwCount = 0; + pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */ + pdsch->rnti = cell->dlAlloc[slot]->msg4Info->crnti; + pdsch->pduIndex = 0; + pdsch->pdschBwpCfg.BWPSize = initialBwp->bwp.numPrb; + pdsch->pdschBwpCfg.BWPStart = initialBwp->bwp.firstPrb; + pdsch->numCodewords = 1; + for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++) + { + pdsch->codeword[cwCount].targetCodeRate = 308; + pdsch->codeword[cwCount].qamModOrder = 2; + pdsch->codeword[cwCount].mcsIndex = 4; /* mcs configured to 4 */ + pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */ + pdsch->codeword[cwCount].rvIndex = 0; + /* 38.214: Table 5.1.3.2-1, divided by 8 to get the value in bytes */ + /* TODO : Calculate tbSize based of DL CCCH msg size */ + pdsch->codeword[cwCount].tbSize = 2664/8; + } + pdsch->dataScramblingId = cell->cellCfg.phyCellId; + pdsch->numLayers = 1; + pdsch->transmissionScheme = 0; + pdsch->refPoint = 0; + pdsch->dmrs.dlDmrsSymbPos = 2; + pdsch->dmrs.dmrsConfigType = 0; /* type-1 */ + pdsch->dmrs.dlDmrsScramblingId = cell->cellCfg.phyCellId; + pdsch->dmrs.scid = 0; + pdsch->dmrs.numDmrsCdmGrpsNoData = 1; + pdsch->dmrs.dmrsPorts = 0; + pdsch->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */ + /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ + pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; + /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 * + * Ninfo = S . Nre . R . Qm . v * + * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh * + * Nre = min(156,Nre') . nPrb */ + /* TODO : Calculate rbSize based on tbSize calculated */ + pdsch->freqAlloc.rbSize = 34; + pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */ + pdsch->timeAlloc.startSymbolIndex = 2; /* spec-38.214, Table 5.1.2.1-1 */ + pdsch->timeAlloc.numSymbols = 12; + pdsch->beamPdschInfo.numPrgs = 1; + pdsch->beamPdschInfo.prgSize = 1; + pdsch->beamPdschInfo.digBfInterfaces = 0; + pdsch->beamPdschInfo.prg[0].pmIdx = 0; + pdsch->beamPdschInfo.prg[0].beamIdx[0] = 0; + pdsch->txPdschPower.powerControlOffset = 0; + pdsch->txPdschPower.powerControlOffsetSS = 0; + + pdcch->dci.pdschCfg = pdsch; + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index 651808b39..69d2a62df 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -64,8 +64,6 @@ #include "sch_utils.h" extern SchCb schCb[SCH_MAX_INST]; -extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4]; -extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; extern uint8_t puschDeltaTable[MAX_MU_PUSCH]; /** @@ -292,7 +290,7 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of } /* calculate the PRBs */ - freqDomResourceAlloc( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); + calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); /* fill the PDCCH PDU */ pdcch->pdcchBwpCfg.BWPSize = initialBwp->bwp.numPrb; diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 4ffbdcde7..604ad1feb 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -60,6 +60,7 @@ File: sch_slot_ind.c #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "sch.h" +#include "sch_utils.h" SchMacDlAllocFunc schMacDlAllocOpts[] = { @@ -99,6 +100,7 @@ int sendDlAllocToMac(DlAlloc *dlAlloc, Inst inst) return(*schMacDlAllocOpts[pst.selector])(&pst, dlAlloc); } + /******************************************************************* * * @brief Handles slot indication at SCH @@ -126,6 +128,7 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) memset(&dlAlloc,0,sizeof(DlAlloc)); DlBrdcstAlloc *dlBrdcstAlloc = &dlAlloc.brdcstAlloc; RarAlloc *rarAlloc = &dlAlloc.rarAlloc; + Msg4Alloc *msg4Alloc; dlBrdcstAlloc->ssbTrans = NO_SSB; dlBrdcstAlloc->sib1Trans = NO_SIB1; @@ -208,6 +211,29 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) cell->dlAlloc[slot]->rarPres = false; } + /* check for MSG4 */ + if(cell->dlAlloc[slot]->msg4Info) + { + SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc)); + if(!msg4Alloc) + { + DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc"); + return RFAILED; + } + + dlAlloc.msg4Alloc = msg4Alloc; + + /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */ + memcpy(&msg4Alloc->msg4Info, cell->dlAlloc[slot]->msg4Info, \ + sizeof(Msg4Info)); + + /* pdcch and pdsch data is filled */ + schDlRsrcAllocMsg4(msg4Alloc, cell, slot); + SCH_FREE(cell->dlAlloc[slot]->msg4Info, sizeof(Msg4Info)); + cell->dlAlloc[slot]->msg4Info = NULL; + } + + /* send msg to MAC */ ret = sendDlAllocToMac(&dlAlloc, schInst); if(ret != ROK) diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index a2f0d5e04..0a79d678b 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -387,7 +387,7 @@ uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 }; * * @details * - * Function : freqDomResourceAlloc + * Function: canclulatePRB * * This function does allocation in frequency domain resource. using * bitwise operator, the bits are set for the PRBs. @@ -397,7 +397,7 @@ uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 }; * @param[in] freqDomain - 6 bytes of info, each bit represents a group of 6 PRB. * @return void **/ -void freqDomResourceAlloc(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain) +void calculatePRB(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain) { uint8_t remBits = prbSize; /* each bit represents 6 PRBs */ uint8_t firstByte = 1; diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index e139e878b..6616e3ab5 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -31,7 +31,10 @@ } /* functions declarations */ -void freqDomResourceAlloc(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain); +void calculatePRB(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain); + +extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4]; +extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; /********************************************************************** End of file diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 2b2449930..be2439c47 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -115,6 +115,35 @@ int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) return ROK; } +/******************************************************************* + * + * @brief Pack and Send DL RLC BO Info from MAC to SCH + * + * @details + * + * Function : packMacSchDlRlcBoInfo + * + * Functionality: + * Pack and Send L RLC BO Info from MAC to SCH + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo) +{ + if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} + /** * @brief function to pack DL Broadcast allocation message * from MAC to SCH diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 0c599ee9a..927ac16ce 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -19,8 +19,11 @@ /* events */ #define EVENT_SCH_CELL_CFG 1 #define EVENT_SCH_CELL_CFG_CFM 2 -#define EVENT_DL_ALLOC 3 +#define EVENT_DL_ALLOC 3 #define EVENT_UL_SCH_INFO 4 +#define EVENT_RACH_IND_TO_SCH 5 +#define EVENT_CRC_IND_TO_SCH 6 +#define EVENT_DL_RLC_BO_INFO_TO_SCH 7 /* selector */ #define MAC_SCH_LC_SELECTOR 0 @@ -51,6 +54,9 @@ #define SCH_DATATYPE_PRACH 16 #define MAX_NUMBER_OF_CRC_IND_BITS 1 +#define MAX_NUM_LOGICAL_CHANNELS 11 + +#define CCCH_LCID 0 /*structures*/ @@ -387,6 +393,27 @@ typedef struct rarAlloc PdschCfg rarPdschCfg; }RarAlloc; +typedef struct msg4Info +{ + uint8_t ndi; + uint8_t harqProcNum; + uint8_t dlAssignIdx; + uint8_t pucchTpc; + uint8_t pucchResInd; + uint8_t harqFeedbackInd; + uint8_t dciFormatId; + uint16_t crnti; + uint8_t *msg4Pdu; + uint8_t msg4PduLen; +}Msg4Info; + +typedef struct msg4Alloc +{ + Msg4Info msg4Info; + PdcchCfg msg4PdcchCfg; + PdschCfg msg4PdschCfg; +}Msg4Alloc; + typedef struct dlAlloc { uint16_t cellId; /* Cell Id */ @@ -399,6 +426,9 @@ typedef struct dlAlloc /* Allocation for RAR message */ uint8_t isRarPres; RarAlloc rarAlloc; + + /* Allocation from MSG4 */ + Msg4Alloc *msg4Alloc; }DlAlloc; typedef struct tbInfo @@ -450,6 +480,20 @@ typedef struct crcIndInfo uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS]; }CrcIndInfo; +typedef struct boInfo +{ + uint8_t lcId; + uint32_t dataVolume; +}BOInfo; + +typedef struct dlRlcBOInfo +{ + uint16_t cellId; + uint16_t crnti; + uint16_t numLc; + BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS]; +}DlRlcBOInfo; + /* function pointers */ @@ -493,6 +537,10 @@ int macSchRachInd(Pst *pst, RachIndInfo *rachInd); typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd); int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd); +typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo); +uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo); +uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo); + /********************************************************************** End of file diff --git a/src/cm/tfu.h b/src/cm/tfu.h index dac320244..6a59ca6a9 100755 --- a/src/cm/tfu.h +++ b/src/cm/tfu.h @@ -123,12 +123,6 @@ #define EVTTFUNONRTIND 24 /*!< Non-RT indication.*/ #endif #define EVTTFUERRIND 25 /*!< TFU Error Indication */ -#define EVENT_RACH_IND_TO_MAC 26 -#define EVENT_RACH_IND_TO_SCH 27 -#define EVENT_CRC_IND_TO_MAC 28 -#define EVENT_CRC_IND_TO_SCH 29 -#define EVENT_RX_DATA_IND_TO_MAC 30 -#define EVENT_STOP_IND_TO_MAC 31 /** @} */ #define MAX_PREAM_PER_SLOT 1 /* Max number of preamble per slot */ -- 2.16.6