Rach Indication
[o-du/l2.git] / src / 5gnrsch / sch.c
index 4214673..a377201 100644 (file)
 #include "sch.h"
 #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[] = 
 {
@@ -306,6 +306,28 @@ SlotIndInfo         *slotInd
    RETVALUE(ROK);
 }  /* macSchSlotInd */
 
+/*******************************************************************
+ *
+ * @brief Processes Rach indication from MAC 
+ *
+ * @details
+ *
+ *    Function : macSchRachInd
+ *
+ *    Functionality:
+ *      Processes Rach indication from MAC
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+int macSchRachInd(Pst *pst, RachIndInfo *rachInd)
+{
+   DU_LOG("\nSCH : Received Rach indication");
+   return ROK;
+}
+
 /**
  * @brief inti cellCb based on cellCfg
  *
@@ -347,6 +369,9 @@ int InitSchCellCb(Inst inst, SchCellCfg *schCellCfg)
    for(uint8_t idx=0; idx<SCH_NUM_SLOTS; idx++)
        {
                SchDlAlloc *schDlAlloc;
+               SchUlAlloc *schUlAlloc;
+
+      /* DL Alloc */
                SCH_ALLOC(schDlAlloc, sizeof(SchDlAlloc));
                if(!schDlAlloc)
                {
@@ -354,20 +379,32 @@ int InitSchCellCb(Inst inst, SchCellCfg *schCellCfg)
                        return RFAILED;
                }
 
-      schDlAlloc->totalPrb = MAX_NUM_RB;
+      /* UL Alloc */
+               SCH_ALLOC(schUlAlloc, sizeof(SchUlAlloc));
+               if(!schUlAlloc)
+               {
+                       DU_LOG("\nMemory allocation failed in InitSchCellCb");
+                       return RFAILED;
+               }
+
+      schDlAlloc->totalPrb = schUlAlloc->totalPrb = MAX_NUM_RB;
 
-               for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
+               for(uint8_t itr=0; itr<SCH_SYMBOL_PER_SLOT; itr++)
                {
                        schDlAlloc->assignedPrb[itr] = 0;
+                       schUlAlloc->assignedPrb[itr] = 0;
                }
+
                for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
                {
                        memset(&schDlAlloc->ssbInfo[itr], 0, sizeof(SsbInfo));
                }
 
                cell->dlAlloc[idx] = schDlAlloc;
+               cell->ulAlloc[idx] = schUlAlloc;
+
        }
-       schCb[inst].cells[inst] = cell; //Sphoorthi TODO: check if this works
+       schCb[inst].cells[inst] = cell;
 
    DU_LOG("\nCell init completed for cellId:%d", cell->cellId);