Fixes for SIB1 transmission and FAPI STOP.request [Issue-ID: ODUHIGH-325]
[o-du/l2.git] / src / 5gnrsch / sch.c
index f68015d..3be7fba 100644 (file)
@@ -684,7 +684,8 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    uint8_t mValue = 0;
    uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t slotIndex = 0;
-   uint8_t FreqDomainResource[6] = {0};
+   /* TODO : This should be filled through freqDomRscAllocType0() */
+   uint8_t FreqDomainResource[6] = {15, 0, 0, 0, 0, 0};
    uint16_t tbSize = 0;
    uint8_t numPdschSymbols = 11; /* considering pdsch region from symbols 3 to 13 */
    uint8_t ssbIdx = 0;
@@ -717,7 +718,7 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    sib1SchCfg->n0 = slotIndex;
 
    /* calculate the PRBs */
-   freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   //freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
    switch(bandwidth)
@@ -793,7 +794,7 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    pdsch->dmrs.dlDmrsScramblingId            = pci;
    pdsch->dmrs.scid                          = 0;
    pdsch->dmrs.numDmrsCdmGrpsNoData          = 1;
-   pdsch->dmrs.dmrsPorts                     = 0;
+   pdsch->dmrs.dmrsPorts                     = 0x0001;
    pdsch->dmrs.mappingType                   = DMRS_MAP_TYPE_A; /* Type-A */
    pdsch->dmrs.nrOfDmrsSymbols               = NUM_DMRS_SYMBOLS;
    pdsch->dmrs.dmrsAddPos                    = DMRS_ADDITIONAL_POS;
@@ -900,12 +901,18 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    DU_LOG("\nDEBUG  -->  SCH : Received RLC BO Status indication");
    cell = schCb[inst].cells[inst];
 
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  -->  SCH : MacSchDlRlcBoInfo(): Cell does not exists");
+      return RFAILED;
+   }
+
    GET_UE_IDX(dlBoInfo->crnti, ueIdx);
    ueCb = &cell->ueCb[ueIdx-1];
    lcId  = dlBoInfo->lcId;
 
    if(lcId == SRB1_LCID || lcId == SRB2_LCID || lcId == SRB3_LCID || \
-      (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
+         (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
    {
       SET_ONE_BIT(ueIdx, cell->boIndBitMap);
       ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
@@ -924,20 +931,27 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
       slotIdx++;
       if(slotIdx==cell->numSlots)
       {
-          DU_LOG("\nERROR  -->  SCH : No DL Slot available");
-          return RFAILED;
+         DU_LOG("\nERROR  -->  SCH : No DL Slot available");
+         return RFAILED;
       }
    }
 #endif
+
    schDlSlotInfo = cell->schDlSlotInfo[slot];
 
+   if(schDlSlotInfo == NULLP)
+   {
+      DU_LOG("\nERROR  -->  SCH : MacSchDlRlcBoInfo(): schDlSlotInfo does not exists");
+      return RFAILED;
+   }
    SCH_ALLOC(schDlSlotInfo->dlMsgInfo, sizeof(DlMsgInfo));
-   if(!schDlSlotInfo->dlMsgInfo)
+   if(schDlSlotInfo->dlMsgInfo == NULLP)
    {
       DU_LOG("\nERROR  -->  SCH : Memory allocation failed for dlMsgInfo");
       schDlSlotInfo = NULL;
       return RFAILED;
    }
+   
    schDlSlotInfo->dlMsgInfo->crnti = dlBoInfo->crnti;
    schDlSlotInfo->dlMsgInfo->ndi = 1;
    schDlSlotInfo->dlMsgInfo->harqProcNum = 0;
@@ -947,8 +961,10 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    schDlSlotInfo->dlMsgInfo->harqFeedbackInd = 0;
    schDlSlotInfo->dlMsgInfo->dciFormatId = 1;
    if(lcId == SRB0_LCID)
+   {
       schDlSlotInfo->dlMsgInfo->isMsg4Pdu = true;
-
+      schDlSlotInfo->dlMsgInfo->dlMsgPduLen = dlBoInfo->dataVolume;
+   }
    return ROK;
 }