fix ODUHIGH-182 updating code to be compatible with latest available fapi_inetrface...
[o-du/l2.git] / src / 5gnrsch / sch_rach.c
index c6f3bde..f4c7a64 100644 (file)
 /** @file sch_rach.c
 @brief This file implements the rach handling.
 */
-
-#include "stdbool.h"
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general layer */
-#include "ssi.h"           /* system service interface */
-#include "cm_tkns.h"       /* Common Token Defines */
-#include "cm_llist.h"      /* Common Link List Defines */
-#include "cm_hash.h"       /* Common Hash List Defines */
-#include "cm_mblk.h"       /* common memory link list library */
-#include "cm_lte.h"        /* Common LTE Defines */
+#include "common_def.h"
 #include "tfu.h"
 #include "lrg.h"
-
-#include "gen.x"           /* general layer typedefs */
-#include "ssi.x"           /* system services typedefs */
-#include "cm5.x"           /* system services */
-#include "cm_tkns.x"       /* Common Token Definitions */
-#include "cm_llist.x"      /* Common Link List Definitions */
-#include "cm_lib.x"        /* Common Library Definitions */
-#include "cm_hash.x"       /* Common Hash List Definitions */
-#include "cm_mblk.x"       /* common memory link list library */
-#include "cm_lte.x"        /* Common LTE Defines */
 #include "tfu.x"
 #include "lrg.x"
 #include "du_log.h"
@@ -62,7 +41,6 @@
 #include "mac_sch_interface.h"
 #include "sch.h"
 #include "sch_utils.h"
-#include "common_def.h"
 
 extern SchCb schCb[SCH_MAX_INST];
 extern uint8_t puschDeltaTable[MAX_MU_PUSCH];
@@ -139,7 +117,7 @@ uint8_t *msg3NumRb)
 
 
    cell = schCb[schInst].cells[schInst];
-       puschMu = cell->cellCfg.puschMu;
+//     puschMu = cell->cellCfg.puschMu;
        delta = puschDeltaTable[puschMu];
        k2 = cell->cellCfg.schInitialUlBwp.puschCommon.k2;
        startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.startSymbol;
@@ -182,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;
@@ -240,12 +221,12 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
        if(ret == ROK)
        {
                /* fill RAR info */
-               rarInfo->raRnti      = raRnti;
-               rarInfo->tcrnti      = rachInd->crnti;
-               rarInfo->RAPID       = rachInd->preambleIdx;
-               rarInfo->ta          = rachInd->timingAdv;
-               rarInfo->msg3StartRb = msg3StartRb;
-               rarInfo->msg3NumRb   = msg3NumRb;
+               rarInfo->raRnti                 = raRnti;
+               rarInfo->tcrnti                 = rachInd->crnti;
+               rarInfo->RAPID                  = rachInd->preambleIdx;
+               rarInfo->ta                     = rachInd->timingAdv;
+               rarInfo->msg3FreqAlloc.startPrb = msg3StartRb;
+               rarInfo->msg3FreqAlloc.numPrb   = msg3NumRb;
        }
    return ret;
 }
@@ -303,13 +284,13 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    }
 
    /* calculate the PRBs */
-   calculatePRB( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   schAllocFreqDomRscType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
-   bwp->BWPSize = initialBwp->bwp.numPrb;
-   bwp->BWPStart = initialBwp->bwp.firstPrb;
-   bwp->subcarrierSpacing = initialBwp->bwp.scs;
-   bwp->cyclicPrefix = initialBwp->bwp.cyclicPrefix;
+   bwp->freqAlloc.numPrb   = initialBwp->bwp.freqAlloc.numPrb;
+   bwp->freqAlloc.startPrb = initialBwp->bwp.freqAlloc.startPrb;
+   bwp->subcarrierSpacing  = initialBwp->bwp.scs;
+   bwp->cyclicPrefix       = initialBwp->bwp.cyclicPrefix;
 
    /* fill the PDCCH PDU */
    pdcch->coreset0Cfg.startSymbolIndex = firstSymbol;
@@ -362,12 +343,15 @@ 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->freqAlloc.resourceAlloc = 1; /* RAT type-1 RIV format */
-   pdsch->freqAlloc.rbStart = offset + SCH_SSB_PRB_DURATION; /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ 
-   pdsch->freqAlloc.rbSize = schCalcNumPrb(tbSize,mcs,numPdschSymbols);
-   pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */
-   pdsch->timeAlloc.startSymbolIndex = initialBwp->pdschCommon.startSymbol;
-   pdsch->timeAlloc.numSymbols = initialBwp->pdschCommon.lengthSymbol;
+       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);
+   pdsch->pdschFreqAlloc.vrbPrbMapping = 0; /* non-interleaved */
+   pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.startSymbol;
+   pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.lengthSymbol;
    pdsch->beamPdschInfo.numPrgs = 1;
    pdsch->beamPdschInfo.prgSize = 1;
    pdsch->beamPdschInfo.digBfInterfaces = 0;