[Epic-ID: ODUHIGH-][Task-ID: ODUHIGH-]WG8 alignment | Cell conf 89/10289/15
authorlal.harshita <Harshita.Lal@radisys.com>
Thu, 19 Jan 2023 07:56:55 +0000 (13:26 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Thu, 16 Feb 2023 09:43:44 +0000 (15:13 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: I6b308c04936f2661f47cd805f369ec18c471b67d
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
23 files changed:
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/mac.h
src/5gnrmac/mac_cfg_hdl.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_crc.c
src/5gnrsch/sch_harq_dl.c
src/5gnrsch/sch_harq_ul.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_slot_ind.c
src/5gnrsch/sch_ue_mgr.c
src/cm/common_def.c
src/cm/common_def.h
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/cu_stub/cu_stub.c
src/du_app/du_cell_mgr.c
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_mgr_main.c

index 1cfc943..a03b69a 100644 (file)
@@ -2015,7 +2015,7 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
    p_fapi_api_queue_elem_t  cfgReqQElem;
 
    DU_LOG("\nINFO  -->  LWR_MAC: Received EVENT[%d] at STATE[%d]", lwrMacCb.event, \
-        lwrMacCb.phyState);
+         lwrMacCb.phyState);
 
    cellId = (uint16_t *)msg;
    GET_CELL_IDX(*cellId, cellIdx);
@@ -2024,7 +2024,7 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
    /* Fill Cell Configuration in lwrMacCb */
    memset(&lwrMacCb.cellCb[lwrMacCb.numCell], 0, sizeof(LwrMacCellCb));
    lwrMacCb.cellCb[lwrMacCb.numCell].cellId = macCfgParams.cellId;
-   lwrMacCb.cellCb[lwrMacCb.numCell].phyCellId = macCfgParams.phyCellId; 
+   lwrMacCb.cellCb[lwrMacCb.numCell].phyCellId = macCfgParams.cellCfg.phyCellId; 
    lwrMacCb.numCell++;
 
    /* Allocte And fill Vendor msg */
@@ -2064,7 +2064,7 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
       return RFAILED;
    }
    FILL_FAPI_LIST_ELEM(cfgReqQElem, vendorMsgQElem, FAPI_CONFIG_REQUEST, 1, \
-      sizeof(fapi_config_req_t));
+         sizeof(fapi_config_req_t));
 
    configReq = (fapi_config_req_t *)(cfgReqQElem + 1);
    memset(configReq, 0, sizeof(fapi_config_req_t));
@@ -2077,70 +2077,64 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
 
    msgLen = sizeof(configReq->number_of_tlvs);
 
-   if(macCfgParams.dlCarrCfg.pres)
-   {
-      fillTlvs(&configReq->tlvs[index++], FAPI_DL_BANDWIDTH_TAG,           \
-         sizeof(uint32_t), macCfgParams.dlCarrCfg.bw, &msgLen);
-      fillTlvs(&configReq->tlvs[index++], FAPI_DL_FREQUENCY_TAG,           \
-         sizeof(uint32_t), macCfgParams.dlCarrCfg.freq, &msgLen);
-      /* Due to bug in Intel FT code, commenting TLVs that are are not 
-       * needed to avoid error. Must be uncommented when FT bug is fixed */
-      //fillTlvs(&configReq->tlvs[index++], FAPI_DL_K0_TAG,                  \
-         sizeof(uint16_t), macCfgParams.dlCarrCfg.k0[0], &msgLen);
-      //fillTlvs(&configReq->tlvs[index++], FAPI_DL_GRIDSIZE_TAG,            \
-         sizeof(uint16_t), macCfgParams.dlCarrCfg.gridSize[0], &msgLen);
-      fillTlvs(&configReq->tlvs[index++], FAPI_NUM_TX_ANT_TAG,             \
-         sizeof(uint16_t), macCfgParams.dlCarrCfg.numAnt, &msgLen);
-   }
-   if(macCfgParams.ulCarrCfg.pres)
-   {
-      fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_BANDWIDTH_TAG,       \
-           sizeof(uint32_t), macCfgParams.ulCarrCfg.bw, &msgLen);
-      fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_FREQUENCY_TAG,       \
-           sizeof(uint32_t), macCfgParams.ulCarrCfg.freq, &msgLen);
-      //fillTlvs(&configReq->tlvs[index++], FAPI_UL_K0_TAG,                  \
-      sizeof(uint16_t), macCfgParams.ulCarrCfg.k0[0], &msgLen);
-      //fillTlvs(&configReq->tlvs[index++], FAPI_UL_GRID_SIZE_TAG,           \
-      sizeof(uint16_t), macCfgParams.ulCarrCfg.gridSize[0], &msgLen);
-      fillTlvs(&configReq->tlvs[index++], FAPI_NUM_RX_ANT_TAG,             \
-           sizeof(uint16_t), macCfgParams.ulCarrCfg.numAnt, &msgLen);
-   }
+   fillTlvs(&configReq->tlvs[index++], FAPI_DL_BANDWIDTH_TAG,           \
+         sizeof(uint32_t), macCfgParams.carrCfg.dlBw, &msgLen);
+   fillTlvs(&configReq->tlvs[index++], FAPI_DL_FREQUENCY_TAG,           \
+         sizeof(uint32_t), macCfgParams.carrCfg.dlFreq, &msgLen);
+   /* Due to bug in Intel FT code, commenting TLVs that are are not 
+    * needed to avoid error. Must be uncommented when FT bug is fixed */
+   //fillTlvs(&configReq->tlvs[index++], FAPI_DL_K0_TAG,                  \
+   sizeof(uint16_t), macCfgParams.dlCarrCfg.k0[0], &msgLen);
+   //fillTlvs(&configReq->tlvs[index++], FAPI_DL_GRIDSIZE_TAG,            \
+   sizeof(uint16_t), macCfgParams.dlCarrCfg.gridSize[0], &msgLen);
+   fillTlvs(&configReq->tlvs[index++], FAPI_NUM_TX_ANT_TAG,             \
+         sizeof(uint16_t), macCfgParams.carrCfg.numTxAnt, &msgLen);
+   fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_BANDWIDTH_TAG,       \
+         sizeof(uint32_t), macCfgParams.carrCfg.ulBw, &msgLen);
+   fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_FREQUENCY_TAG,       \
+         sizeof(uint32_t), macCfgParams.carrCfg.ulFreq, &msgLen);
+   //fillTlvs(&configReq->tlvs[index++], FAPI_UL_K0_TAG,                  \
+   sizeof(uint16_t), macCfgParams.ulCarrCfg.k0[0], &msgLen);
+   //fillTlvs(&configReq->tlvs[index++], FAPI_UL_GRID_SIZE_TAG,           \
+   sizeof(uint16_t), macCfgParams.ulCarrCfg.gridSize[0], &msgLen);
+   fillTlvs(&configReq->tlvs[index++], FAPI_NUM_RX_ANT_TAG,             \
+         sizeof(uint16_t), macCfgParams.carrCfg.numRxAnt, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG,   \
    sizeof(uint8_t), macCfgParams.freqShft, &msgLen);
 
    /* fill cell config */
    fillTlvs(&configReq->tlvs[index++], FAPI_PHY_CELL_ID_TAG,               \
-        sizeof(uint8_t), macCfgParams.phyCellId, &msgLen);
+         sizeof(uint8_t), macCfgParams.cellCfg.phyCellId, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_FRAME_DUPLEX_TYPE_TAG,         \
-        sizeof(uint8_t), macCfgParams.dupType, &msgLen);
+         sizeof(uint8_t), macCfgParams.cellCfg.dupType, &msgLen);
 
    /* fill SSB configuration */
    fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_POWER_TAG,             \
-        sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr, &msgLen);
+         sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_BCH_PAYLOAD_TAG,               \
    sizeof(uint8_t), macCfgParams.ssbCfg.bchPayloadFlag, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_SCS_COMMON_TAG,                \
-        sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn, &msgLen);
+         sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn, &msgLen);
 
    /* fill PRACH configuration */
    //fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SEQUENCE_LENGTH_TAG,     \
    sizeof(uint8_t), macCfgParams.prachCfg.prachSeqLen, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SUBC_SPACING_TAG,        \
-        sizeof(uint8_t), convertScsValToScsEnum(macCfgParams.prachCfg.prachSubcSpacing), &msgLen);
+         sizeof(uint8_t), convertScsValToScsEnum(macCfgParams.prachCfg.prachSubcSpacing), &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_RESTRICTED_SET_CONFIG_TAG,     \
-        sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg, &msgLen);
+         sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_NUM_PRACH_FD_OCCASIONS_TAG,
-        sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm, &msgLen);
+         sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_CONFIG_INDEX_TAG,
-        sizeof(uint8_t), macCfgParams.prachCfg.prachCfgIdx, &msgLen);
+         sizeof(uint8_t), macCfgParams.prachCfg.prachCfgIdx, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG, \
-        sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx, &msgLen);
+         sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_NUM_ROOT_SEQUENCES_TAG,        \
    sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numRootSeq, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_K1_TAG,                        \
-        sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
+         sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ZERO_CORR_CONF_TAG ,     \
-        sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
+         sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG, \
    sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen);
    /* if(macCfgParams.prachCfg.fdm[0].numUnusedRootSeq)
@@ -2156,28 +2150,28 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
       }*/
 
    fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PER_RACH_TAG,              \
-        sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
+         sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG,  \
    sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen);
 
    /* fill SSB table */
    fillTlvs(&configReq->tlvs[index++], FAPI_SSB_OFFSET_POINT_A_TAG,        \
-        sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA, &msgLen);
+         sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_BETA_PSS_TAG,                  \
    sizeof(uint8_t),  macCfgParams.ssbCfg.betaPss, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PERIOD_TAG,                \
-        sizeof(uint8_t),  macCfgParams.ssbCfg.ssbPeriod, &msgLen);
+         sizeof(uint8_t),  macCfgParams.ssbCfg.ssbPeriod, &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_SSB_SUBCARRIER_OFFSET_TAG,     \
-        sizeof(uint8_t),  macCfgParams.ssbCfg.ssbScOffset, &msgLen);
+         sizeof(uint8_t),  macCfgParams.ssbCfg.ssbScOffset, &msgLen);
 
    setMibPdu(macCfgParams.ssbCfg.mibPdu, &mib, 0);
    fillTlvs(&configReq->tlvs[index++], FAPI_MIB_TAG ,                      \
-        sizeof(uint32_t), mib, &msgLen);
+         sizeof(uint32_t), mib, &msgLen);
 
    fillTlvs(&configReq->tlvs[index++], FAPI_SSB_MASK_TAG,                  \
-        sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0], &msgLen);
+         sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0], &msgLen);
    fillTlvs(&configReq->tlvs[index++], FAPI_BEAM_ID_TAG,                   \
-        sizeof(uint8_t),  macCfgParams.ssbCfg.beamId[0], &msgLen);
+         sizeof(uint8_t),  macCfgParams.ssbCfg.beamId[0], &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, \
    sizeof(uint8_t), macCfgParams.ssbCfg.multCarrBand, &msgLen);
    //fillTlvs(&configReq->tlvs[index++], FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG, \
@@ -2186,24 +2180,45 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
 #ifdef NR_TDD
    /* fill TDD table */
    fillTlvs(&configReq->tlvs[index++], FAPI_TDD_PERIOD_TAG,                \
-   sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod, &msgLen);
-   for(slotIdx =0 ;slotIdx< MAX_TDD_PERIODICITY_SLOTS; slotIdx++) 
+         sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod, &msgLen);
+
+   for(slotIdx =0 ;slotIdx < MAX_TDD_PERIODICITY_SLOTS; slotIdx++) 
    {
-      for(symbolIdx = 0; symbolIdx< MAX_SYMB_PER_SLOT; symbolIdx++)
+      for(symbolIdx = 0; symbolIdx < MAX_SYMB_PER_SLOT; symbolIdx++)
       {
-        fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG,               \
-              sizeof(uint8_t), macCfgParams.tddCfg.slotCfg[slotIdx][symbolIdx], &msgLen);
+         /*Fill Full-DL Slots as well as DL symbols ini 1st Flexi Slo*/
+         if(slotIdx < macCfgParams.tddCfg.nrOfDlSlots || \
+               (slotIdx == macCfgParams.tddCfg.nrOfDlSlots && symbolIdx < macCfgParams.tddCfg.nrOfDlSymbols)) 
+         {
+            fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG,               \
+                  sizeof(uint8_t), DL_SYMBOL, &msgLen);
+         }
+
+         /*Fill Full-FLEXI SLOT and as well as Flexi Symbols in 1 slot preceding FULL-UL slot*/ 
+         else if(slotIdx < (MAX_TDD_PERIODICITY_SLOTS - macCfgParams.tddCfg.nrOfUlSlots -1) ||  \
+               (slotIdx == (MAX_TDD_PERIODICITY_SLOTS - macCfgParams.tddCfg.nrOfUlSlots -1) && \
+                symbolIdx < (MAX_SYMB_PER_SLOT - macCfgParams.tddCfg.nrOfUlSymbols)))
+         {
+            fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG,               \
+                  sizeof(uint8_t), FLEXI_SYMBOL, &msgLen);
+         }
+         /*Fill Partial UL symbols and Full-UL slot*/
+         else
+         {
+            fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG,               \
+                  sizeof(uint8_t), UL_SYMBOL, &msgLen);
+         }
       }
    }
 #endif   
-   
+
    /* fill measurement config */
    //fillTlvs(&configReq->tlvs[index++], FAPI_RSSI_MEASUREMENT_TAG,          \
    sizeof(uint8_t), macCfgParams.rssiUnit, &msgLen);
 
    /* fill DMRS Type A Pos */
    fillTlvs(&configReq->tlvs[index++], FAPI_DMRS_TYPE_A_POS_TAG,           \
-        sizeof(uint8_t), macCfgParams.dmrsTypeAPos, &msgLen);
+         sizeof(uint8_t), macCfgParams.ssbCfg.dmrsTypeAPos, &msgLen);
 
    /* Fill message header */
    LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
@@ -2215,7 +2230,7 @@ uint8_t lwr_mac_procConfigReqEvt(void *msg)
       return RFAILED;
    }
    FILL_FAPI_LIST_ELEM(headerElem, cfgReqQElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
-        sizeof(fapi_msg_header_t));
+         sizeof(fapi_msg_header_t));
    msgHeader = (fapi_msg_header_t *)(headerElem + 1);
    msgHeader->num_msg = 2; /* Config req msg and vendor specific msg */
    msgHeader->handle = 0;
@@ -2443,7 +2458,7 @@ uint8_t fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg,
    if(dlTtiReqPdu != NULL)
    {
       dlTtiReqPdu->pduType = SSB_PDU_TYPE;     /* SSB PDU */
-      dlTtiReqPdu->pdu.ssb_pdu.physCellId = macCellCfg->phyCellId;
+      dlTtiReqPdu->pdu.ssb_pdu.physCellId = macCellCfg->cellCfg.phyCellId;
       dlTtiReqPdu->pdu.ssb_pdu.betaPss = macCellCfg->ssbCfg.betaPss;
       dlTtiReqPdu->pdu.ssb_pdu.ssbBlockIndex = currDlSlot->dlInfo.brdcstAlloc.ssbInfo[ssbIdxCount].ssbIdx;
       dlTtiReqPdu->pdu.ssb_pdu.ssbSubCarrierOffset = macCellCfg->ssbCfg.ssbScOffset;;
@@ -3404,8 +3419,8 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, MacCel
    }
    payloadElem = (fapi_api_queue_elem_t *)sib1Payload;
    FILL_FAPI_LIST_ELEM(payloadElem, NULLP, FAPI_VENDOR_MSG_PHY_ZBC_BLOCK_REQ, 1, \
-      macCellCfg->sib1Cfg.sib1PduLen);
-   memcpy(sib1Payload + TX_PAYLOAD_HDR_LEN, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
+      macCellCfg->cellCfg.sib1Cfg.sib1PduLen);
+   memcpy(sib1Payload + TX_PAYLOAD_HDR_LEN, macCellCfg->cellCfg.sib1Cfg.sib1Pdu, macCellCfg->cellCfg.sib1Cfg.sib1PduLen);
 
 #ifdef INTEL_WLS_MEM
    mtGetWlsHdl(&wlsHdlr);
@@ -4146,7 +4161,7 @@ void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
    if(ulTtiReqPdu != NULLP)
    {
       ulTtiReqPdu->pduType = PRACH_PDU_TYPE; 
-      ulTtiReqPdu->pdu.prach_pdu.physCellId = macCellCfg->phyCellId;
+      ulTtiReqPdu->pdu.prach_pdu.physCellId = macCellCfg->cellCfg.phyCellId;
       ulTtiReqPdu->pdu.prach_pdu.numPrachOcas = \
          currUlSlot->ulInfo.prachSchInfo.numPrachOcas;
       ulTtiReqPdu->pdu.prach_pdu.prachFormat = \
index 3b13782..067a3cd 100644 (file)
@@ -52,6 +52,15 @@ typedef enum{
    P_RNTI_TYPE
 }RntiType;
 
+#ifdef NR_TDD
+typedef enum
+{
+   DL_SYMBOL,
+   UL_SYMBOL,
+   FLEXI_SYMBOL
+}SymbolConfig;
+#endif
+
 uint8_t lwr_mac_procInvalidEvt(void *msg);
 uint8_t lwr_mac_procParamReqEvt(void *msg);
 uint8_t lwr_mac_procParamRspEvt(void *msg);
index 10538aa..e84bba3 100644 (file)
@@ -75,7 +75,7 @@ typedef enum
    CELL_STATE_UP,
    CELL_TO_BE_STOPPED,
    CELL_STOP_IN_PROGRESS,
-}CellState;       
+}MacCellStatus;           
 
 typedef enum
 {
@@ -228,18 +228,18 @@ typedef struct macUeCb
 
 struct macCellCb
 {
-   uint16_t    cellId;
-   uint16_t    numOfSlots;
-   CellState   state;
-   uint16_t    crntiMap;
-   MacRaCbInfo macRaCb[MAX_NUM_UE];
-   MacDlSlot   dlSlot[MAX_SLOTS];
-   MacUlSlot   ulSlot[MAX_SLOTS];
-   uint16_t    numActvUe;
-   MacUeCfg    *ueCfgTmpData[MAX_NUM_UE];
-   MacUeRecfg  *ueRecfgTmpData[MAX_NUM_UE];
-   MacUeCb     ueCb[MAX_NUM_UE];
-   MacCellCfg  macCellCfg;
+   uint16_t       cellId;
+   uint16_t       numOfSlots;
+   MacCellStatus  state;
+   uint16_t       crntiMap;
+   MacRaCbInfo    macRaCb[MAX_NUM_UE];
+   MacDlSlot      dlSlot[MAX_SLOTS];
+   MacUlSlot      ulSlot[MAX_SLOTS];
+   uint16_t       numActvUe;
+   MacUeCfg       *ueCfgTmpData[MAX_NUM_UE];
+   MacUeRecfg     *ueRecfgTmpData[MAX_NUM_UE];
+   MacUeCb        ueCb[MAX_NUM_UE];
+   MacCellCfg     macCellCfg;
    SlotTimingInfo currTime;
 };
 
index 23c1bf7..cd3b9a5 100644 (file)
@@ -136,7 +136,7 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    Pst cfmPst;
    uint16_t cellIdx;
-   uint8_t ret = ROK, sliceIdx = 0;
+   uint8_t ret = ROK, plmnIdx = 0,sliceIdx = 0;
    MacCellCb     *macCellCb;
 
    memset((uint8_t *)&cfmPst, 0, sizeof(Pst));
@@ -152,46 +152,48 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
    GET_CELL_IDX(macCellCfg->cellId, cellIdx);
    macCb.macCell[cellIdx] = macCellCb;
    macCb.macCell[cellIdx]->cellId = macCellCfg->cellId;
-   macCb.macCell[cellIdx]->numOfSlots = 10 * (1 << macCellCfg->numerology);
+   macCb.macCell[cellIdx]->numOfSlots = 10 * (1 << macCellCfg->cellCfg.numerology);
    memcpy(&macCb.macCell[cellIdx]->macCellCfg, macCellCfg, sizeof(MacCellCfg));
 
-   MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, \
-        macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
-   if(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu == NULLP)
+   MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, \
+         macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
+   if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu == NULLP)
    {
       DU_LOG("\nERROR  -->  MAC : macCellCb is NULL at handling of sib1Pdu of macCellCfg\n");
       return RFAILED;
    }
-   memcpy(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, \
-        macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
-   
-   macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.numSupportedSlice = macCellCfg->plmnInfoList.numSupportedSlice;
-   MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai, macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.numSupportedSlice\
-         * sizeof(Snssai*));
-   if(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai == NULLP)
-   {
-      DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
-      return RFAILED;
-   }
+   memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, macCellCfg->cellCfg.sib1Cfg.sib1Pdu, \
+         macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
 
-   if(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai)
+   for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
    {
-      for(sliceIdx=0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.numSupportedSlice; sliceIdx++)
+      macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = macCellCfg->cellCfg.plmnInfoList[plmnIdx].numSupportedSlice;
+      MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice\
+            * sizeof(Snssai*));
+      if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
+         return RFAILED;
+      }
+
+      if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai)
       {
-         if(macCellCfg->plmnInfoList.snssai[sliceIdx])
+         for(sliceIdx=0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; sliceIdx++)
          {
-            MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
-            if(!macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai[sliceIdx])
+            if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx])
             {
-               DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
-               return RFAILED;
+               MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
+               if(!macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx])
+               {
+                  DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
+                  return RFAILED;
+               }
+               memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx],\
+                     sizeof(Snssai));
             }
-            memcpy(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai[sliceIdx], macCellCfg->plmnInfoList.snssai[sliceIdx],\
-            sizeof(Snssai));
          }
       }
    }
-
    /* Send cell cfg to scheduler */
    ret = MacSchCellCfgReq(pst, macCellCfg);
    if(ret != ROK)
@@ -230,147 +232,155 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    SchCellCfg schCellCfg;
    Pst        cfgPst;
-   uint8_t    ssbMaskIdx = 0, rsrcListIdx = 0, sliceIdx=0;
+   uint8_t    ssbMaskIdx = 0, rsrcListIdx = 0, sliceIdx=0, plmnIdx = 0;
 
    memset(&cfgPst, 0, sizeof(Pst));
    memset(&schCellCfg, 0, sizeof(SchCellCfg));
    schCellCfg.cellId = macCellCfg->cellId;
-   schCellCfg.phyCellId = macCellCfg->phyCellId;
-   schCellCfg.numerology = macCellCfg->numerology;
-   schCellCfg.dupMode = macCellCfg->dupType;
-   schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
-   schCellCfg.dlFreq = macCellCfg->dlCarrCfg.freq;
-   schCellCfg.ulFreq = macCellCfg->ulCarrCfg.freq;
+   schCellCfg.phyCellId = macCellCfg->cellCfg.phyCellId;
 
-   /* fill ssb scheduler parameters */
-   schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
-   schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
-   schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
-   schCellCfg.ssbSchCfg.ssbPeriod = ssbPeriodicity[macCellCfg->ssbCfg.ssbPeriod];
-   schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
-   for(ssbMaskIdx=0; ssbMaskIdx<SSB_MASK_SIZE; ssbMaskIdx++)
+   for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
    {
-      schCellCfg.ssbSchCfg.nSSBMask[ssbMaskIdx] = macCellCfg->ssbCfg.ssbMask[ssbMaskIdx];
+      schCellCfg.plmnInfoList[plmnIdx].plmn = macCellCfg->cellCfg.plmnInfoList[plmnIdx].plmn;
+      if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai) 
+      {
+         schCellCfg.plmnInfoList[plmnIdx].numSliceSupport = macCellCfg->cellCfg.plmnInfoList[plmnIdx].numSupportedSlice;
+         MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].snssai, schCellCfg.plmnInfoList[plmnIdx].numSliceSupport * sizeof(Snssai*));
+         if(!schCellCfg.plmnInfoList[plmnIdx].snssai)
+         {
+            DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
+            return RFAILED;
+         }
+         for(sliceIdx=0; sliceIdx<schCellCfg.plmnInfoList[plmnIdx].numSliceSupport; sliceIdx++)
+         {
+            if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx])
+            {
+               MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
+               if(!schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx])
+               {
+                  DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
+                  return RFAILED;
+               }
+               memcpy(schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx],  sizeof(Snssai));
+            }
+         }
+      }
    }
-   schCellCfg.ssbSchCfg.totNumSsb = countSetBits(schCellCfg.ssbSchCfg.nSSBMask[0]);
 
-   /* fill SIB1 scheduler parameters */
-   schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen;
-   schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod;
-   schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex;
-   schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex;
-   schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs;
-   schCellCfg.sib1SchCfg.pageCfg.numPO  =  macCellCfg->sib1Cfg.pagingCfg.numPO;
-   schCellCfg.sib1SchCfg.pageCfg.poPresent = macCellCfg->sib1Cfg.pagingCfg.poPresent;
-
-   if(schCellCfg.sib1SchCfg.pageCfg.poPresent)
-   {
-      memcpy(schCellCfg.sib1SchCfg.pageCfg.pagingOcc, macCellCfg->sib1Cfg.pagingCfg.pagingOcc, MAX_PO_PER_PF);
-   }
+   schCellCfg.dupMode = macCellCfg->cellCfg.dupType;
+   schCellCfg.numerology = macCellCfg->cellCfg.numerology;
+   schCellCfg.dlBandwidth = macCellCfg->carrCfg.dlBw;
+   schCellCfg.ulBandwidth = macCellCfg->carrCfg.ulBw;
 
-   /* fill RACH config params */
-   schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
-   schCellCfg.schRachCfg.prachSubcSpacing = \
-                                           macCellCfg->prachCfg.prachSubcSpacing;
-   schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
-   schCellCfg.schRachCfg.msg1Fdm       = macCellCfg->prachCfg.msg1Fdm;
-   schCellCfg.schRachCfg.rootSeqLen    = macCellCfg->prachCfg.rootSeqLen;
-   schCellCfg.schRachCfg.rootSeqIdx    = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
-   schCellCfg.schRachCfg.numRootSeq    = macCellCfg->prachCfg.fdm[0].numRootSeq;
-   schCellCfg.schRachCfg.k1            = macCellCfg->prachCfg.fdm[0].k1;
-   schCellCfg.schRachCfg.totalNumRaPreamble = macCellCfg->prachCfg.totalNumRaPreamble;
-   schCellCfg.schRachCfg.ssbPerRach    = macCellCfg->prachCfg.ssbPerRach;
-   schCellCfg.schRachCfg.numCbPreamblePerSsb = macCellCfg->prachCfg.numCbPreamblePerSsb;
-   schCellCfg.schRachCfg.prachMultCarrBand = macCellCfg->prachCfg.prachMultCarrBand;
-   schCellCfg.schRachCfg.raContResTmr  = macCellCfg->prachCfg.raContResTmr;
-   schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
-   schCellCfg.schRachCfg.raRspWindow   = macCellCfg->prachCfg.raRspWindow;
+   schCellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
 
    /* fill initial DL BWP */
-   schCellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
-   schCellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
-   schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
-   schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
+   schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
+   schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
+   schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
+   
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
-   schCellCfg.schInitialDlBwp.pdschCommon.numTimeDomAlloc = macCellCfg->initialDlBwp.pdschCommon.numTimeDomAlloc;
+   
+   schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.numTimeDomAlloc = macCellCfg->initialDlBwp.pdschCommon.numTimeDomAlloc;
    for(rsrcListIdx = 0; rsrcListIdx<macCellCfg->initialDlBwp.pdschCommon.numTimeDomAlloc; rsrcListIdx++)
    {
-      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].k0 = 
+      schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].k0 = 
          macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].k0;
-      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
+      schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
          macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType;
-      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
+      schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
          macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol;
-      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].lengthSymbol =
+      schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].lengthSymbol =
          macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].lengthSymbol;
    }
 
+   /* fill SIB1 scheduler parameters */
+   schCellCfg.dlCfgCommon.schPcchCfg.numPO  =  macCellCfg->cellCfg.sib1Cfg.pagingCfg.numPO;
+   schCellCfg.dlCfgCommon.schPcchCfg.poPresent = macCellCfg->cellCfg.sib1Cfg.pagingCfg.poPresent;
+   if(schCellCfg.dlCfgCommon.schPcchCfg.poPresent)
+   {
+      memcpy(schCellCfg.dlCfgCommon.schPcchCfg.pagingOcc, macCellCfg->cellCfg.sib1Cfg.pagingCfg.pagingOcc, MAX_PO_PER_PF);
+   }
+
    /* fill initial UL BWP */
-   schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
-   schCellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
-   schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
-   schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
-   schCellCfg.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc = \
-      macCellCfg->initialUlBwp.puschCommon.numTimeDomRsrcAlloc;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
+   /* fill RACH config params */
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.prachCfgIdx   = macCellCfg->prachCfg.prachCfgIdx;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1Fdm       = macCellCfg->prachCfg.msg1Fdm;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.zeroCorrZoneCfg = macCellCfg->prachCfg.fdm[0].zeroCorrZoneCfg; 
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.raRspWindow = macCellCfg->prachCfg.raRspWindow;
+
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.totalNumRaPreamble = macCellCfg->prachCfg.totalNumRaPreamble;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.ssbPerRach    = macCellCfg->prachCfg.ssbPerRach;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.numCbPreamblePerSsb = macCellCfg->prachCfg.numCbPreamblePerSsb;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rootSeqIdx    = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.numRootSeq    = macCellCfg->prachCfg.fdm[0].numRootSeq;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.msg1SubcSpacing = \
+                                            macCellCfg->prachCfg.prachSubcSpacing;
+
+   schCellCfg.ulCfgCommon.schInitialUlBwp.pucchCommon.pucchResourceCommon = \
+                                                                macCellCfg->initialUlBwp.pucchCommon.pucchResourceCommon;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.pucchCommon.pucchGroupHopping = \
+                                                                macCellCfg->initialUlBwp.pucchCommon.pucchGroupHopping;
+   schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc = \
+                                                                macCellCfg->initialUlBwp.puschCommon.numTimeDomRsrcAlloc;
    for(rsrcListIdx = 0; rsrcListIdx < macCellCfg->initialUlBwp.puschCommon.numTimeDomRsrcAlloc; rsrcListIdx++)
    {
-      schCellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].k2 = 
+      schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].k2 = 
          macCellCfg->initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].k2;
-      schCellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
+      schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
          macCellCfg->initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType;
-      schCellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
+      schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
          macCellCfg->initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol;
-      schCellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength =
+      schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength =
          macCellCfg->initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength;
    }
 
-   if(macCellCfg->plmnInfoList.snssai) 
-   {
-      schCellCfg.plmnInfoList.numSliceSupport = macCellCfg->plmnInfoList.numSupportedSlice;
-      MAC_ALLOC(schCellCfg.plmnInfoList.snssai, schCellCfg.plmnInfoList.numSliceSupport * sizeof(Snssai*));
-      if(!schCellCfg.plmnInfoList.snssai)
-      {
-         DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
-         return RFAILED;
-      }
-      for(sliceIdx=0; sliceIdx<schCellCfg.plmnInfoList.numSliceSupport; sliceIdx++)
-      {
-         if(macCellCfg->plmnInfoList.snssai[sliceIdx])
-         {
-            MAC_ALLOC(schCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
-            if(!schCellCfg.plmnInfoList.snssai[sliceIdx])
-            {
-               DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
-               return RFAILED;
-            }
-            memcpy(schCellCfg.plmnInfoList.snssai[sliceIdx], macCellCfg->plmnInfoList.snssai[sliceIdx],  sizeof(Snssai));
-         }
-      }
-   }
-
 #ifdef NR_TDD
    memcpy(&schCellCfg.tddCfg, &macCellCfg->tddCfg, sizeof(TDDCfg));
 #endif
 
+   /* fill ssb scheduler parameters */
+   for(ssbMaskIdx=0; ssbMaskIdx<SSB_MASK_SIZE; ssbMaskIdx++)
+   {
+      schCellCfg.ssbPosInBurst[ssbMaskIdx] = macCellCfg->ssbCfg.ssbMask[ssbMaskIdx];
+   }
+   schCellCfg.ssbPeriod = ssbPeriodicity[macCellCfg->ssbCfg.ssbPeriod];
+   schCellCfg.ssbFrequency = macCellCfg->cellCfg.ssbFreq;
+   schCellCfg.dmrsTypeAPos = macCellCfg->ssbCfg.dmrsTypeAPos;
+   schCellCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
+   schCellCfg.pdcchCfgSib1.coresetZeroIndex = macCellCfg->cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex;
+   schCellCfg.pdcchCfgSib1.searchSpaceZeroIndex = macCellCfg->cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex;
+   schCellCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
+   schCellCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
+   schCellCfg.sib1PduLen = macCellCfg->cellCfg.sib1Cfg.sib1PduLen;
+   
    FILL_PST_MAC_TO_SCH(cfgPst, EVENT_SCH_CELL_CFG);
 
    return(SchMessageRouter(&cfgPst, (void *)&schCellCfg));
@@ -533,10 +543,10 @@ uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId)
  * * ****************************************************************/
 uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
 {
-   uint8_t  ret = ROK, sliceIdx = 0;
+   uint8_t  ret = ROK, sliceIdx = 0, plmnIdx = 0;
    uint16_t cellIdx=0;
    CellDeleteStatus status;
-   
+
 #ifdef CALL_FLOW_DEBUG_LOG
    DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_CELL_DELETE_RSP_TO_MAC\n");
 #endif  
@@ -546,31 +556,34 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
       if(schCellDelRsp->rsp == RSP_OK)
       {
          DU_LOG("\nINFO   -->  MAC : SCH CELL Delete response for cellId[%d] is successful ", \
-         schCellDelRsp->cellId);
+               schCellDelRsp->cellId);
          GET_CELL_IDX(schCellDelRsp->cellId, cellIdx);
          if(macCb.macCell[cellIdx])
          {
             if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId)
             {
                status  = SUCCESSFUL_RSP;
-               if(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai)
+               for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
                {
-                  for(sliceIdx = 0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.numSupportedSlice; sliceIdx++)
+                  if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai)
                   {
-                     MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
+                     for(sliceIdx = 0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; sliceIdx++)
+                     {
+                        MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
+                     }
+                     MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].\
+                           numSupportedSlice * sizeof(Snssai*));
                   }
-                  MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.snssai, macCb.macCell[cellIdx]->macCellCfg.plmnInfoList.\
-                  numSupportedSlice * sizeof(Snssai*));
                }
-               MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, \
-                  macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
+               MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, \
+                     macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
                MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb));
             }
             else
             {
-                DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
-                status = CELL_ID_INVALID;
-                ret = RFAILED;
+               DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
+               status = CELL_ID_INVALID;
+               ret = RFAILED;
             }
          }
          else
index d85b419..8aa6d0a 100644 (file)
@@ -341,15 +341,14 @@ void schInitTddSlotCfg(SchCellCb *cell, SchCellCfg *schCellCfg)
    periodicityInMicroSec = schGetPeriodicityInMsec(schCellCfg->tddCfg.tddPeriod);
    cell->numSlotsInPeriodicity = (periodicityInMicroSec * pow(2, schCellCfg->numerology))/1000;
    cell->slotFrmtBitMap = 0;
-   cell->symbFrmtBitMap = 0;
    for(slotIdx = cell->numSlotsInPeriodicity-1; slotIdx >= 0; slotIdx--)
    {
       symbIdx = 0;
       /* If the first and last symbol are the same, the entire slot is the same type */
-      if((schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx] == schCellCfg->tddCfg.slotCfg[slotIdx][MAX_SYMB_PER_SLOT-1]) &&
-              schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx] != FLEXI_SLOT)
+      if((cell->slotCfg[slotIdx][symbIdx] == cell->slotCfg[slotIdx][MAX_SYMB_PER_SLOT-1]) &&
+              cell->slotCfg[slotIdx][symbIdx] != FLEXI_SLOT)
       {
-         switch(schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx])
+         switch(cell->slotCfg[slotIdx][symbIdx])
          {
             case DL_SLOT:
             {
@@ -370,34 +369,6 @@ void schInitTddSlotCfg(SchCellCb *cell, SchCellCfg *schCellCfg)
       }
       /* slot config is flexible. First set slotBitMap to 10 */
       cell->slotFrmtBitMap = ((cell->slotFrmtBitMap<<2) | (FLEXI_SLOT));
-
-      /* Now set symbol bitmap */ 
-      for(symbIdx = MAX_SYMB_PER_SLOT-1; symbIdx >= 0; symbIdx--)
-      {
-         switch(schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx])
-         {
-            case DL_SLOT:
-            {
-               /*symbol BitMap to be set to 00 */
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap<<2);
-               break;
-            }
-            case UL_SLOT:
-            {
-               /*symbol BitMap to be set to 01 */
-               cell->symbFrmtBitMap = ((cell->symbFrmtBitMap<<2) | (UL_SLOT));
-               break;
-            }
-            case FLEXI_SLOT:
-            {
-               /*symbol BitMap to be set to 10 */
-               cell->symbFrmtBitMap = ((cell->symbFrmtBitMap<<2) | (FLEXI_SLOT));
-               break;
-            }
-            default:
-              DU_LOG("\nERROR  -->  SCH : Invalid slot Config in schInitTddSlotCfg");
-         }
-      }
    }
 }
 #endif
@@ -420,7 +391,7 @@ void fillSsbStartSymb(SchCellCb *cellCb)
 {
    uint8_t cnt, scs, symbIdx, ssbStartSymbArr[SCH_MAX_SSB_BEAM];
 
-   scs = cellCb->cellCfg.ssbSchCfg.scsCommon;
+   scs = cellCb->cellCfg.scsCommon;
 
    memset(ssbStartSymbArr, 0, sizeof(SCH_MAX_SSB_BEAM));
    symbIdx = 0;
@@ -428,41 +399,40 @@ void fillSsbStartSymb(SchCellCb *cellCb)
    switch(scs)
    {
       case SCS_15KHZ:
-        {
-            if(cellCb->cellCfg.dlFreq <= 300000)
-              cnt = 2;/* n = 0, 1 */
+         {
+            if(cellCb->cellCfg.ssbFrequency <= 300000)
+               cnt = 2;/* n = 0, 1 */
             else
                cnt = 4; /* n = 0, 1, 2, 3 */
-           for(uint8_t idx=0; idx<cnt; idx++)
-           {
-              /* start symbol determined using {2, 8} + 14n */
-              ssbStartSymbArr[symbIdx++] = 2 +  MAX_SYMB_PER_SLOT*idx;
-              ssbStartSymbArr[symbIdx++] = 8 +  MAX_SYMB_PER_SLOT*idx;
-           }
-        }
-        break;
+            for(uint8_t idx=0; idx<cnt; idx++)
+            {
+               /* start symbol determined using {2, 8} + 14n */
+               ssbStartSymbArr[symbIdx++] = 2 +  MAX_SYMB_PER_SLOT*idx;
+               ssbStartSymbArr[symbIdx++] = 8 +  MAX_SYMB_PER_SLOT*idx;
+            }
+         }
+         break;
       case SCS_30KHZ:
-        {
-            if(cellCb->cellCfg.dlFreq <= 300000)
-              cnt = 1;/* n = 0 */
+         {
+            if(cellCb->cellCfg.ssbFrequency <= 300000)
+               cnt = 1;/* n = 0 */
             else
                cnt = 2; /* n = 0, 1 */
-           for(uint8_t idx=0; idx<cnt; idx++)
-           {
-              /* start symbol determined using {4, 8, 16, 20} + 28n */
-              ssbStartSymbArr[symbIdx++] = 4 +  MAX_SYMB_PER_SLOT*idx;
-              ssbStartSymbArr[symbIdx++] = 8 +  MAX_SYMB_PER_SLOT*idx;
-              ssbStartSymbArr[symbIdx++] = 16 +  MAX_SYMB_PER_SLOT*idx;
-              ssbStartSymbArr[symbIdx++] = 20 +  MAX_SYMB_PER_SLOT*idx;
+            for(uint8_t idx=0; idx<cnt; idx++)
+            {
+               /* start symbol determined using {4, 8, 16, 20} + 28n */
+               ssbStartSymbArr[symbIdx++] = 4 +  MAX_SYMB_PER_SLOT*idx;
+               ssbStartSymbArr[symbIdx++] = 8 +  MAX_SYMB_PER_SLOT*idx;
+               ssbStartSymbArr[symbIdx++] = 16 +  MAX_SYMB_PER_SLOT*idx;
+               ssbStartSymbArr[symbIdx++] = 20 +  MAX_SYMB_PER_SLOT*idx;
             }
-        }
-        break;
+         }
+         break;
       default:
-        DU_LOG("\nERROR  -->  SCH : SCS %d is currently not supported", scs);
+         DU_LOG("\nERROR  -->  SCH : SCS %d is currently not supported", scs);
    }
    memset(cellCb->ssbStartSymbArr, 0, sizeof(SCH_MAX_SSB_BEAM));
    memcpy(cellCb->ssbStartSymbArr, ssbStartSymbArr, SCH_MAX_SSB_BEAM);
-
 }
 
 
@@ -599,7 +569,8 @@ uint8_t schInitCellCb(Inst inst, SchCellCfg *schCellCfg)
  *              uint8_t offsetPointA : offset
  *  @return  void
  **/
-uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg *sib1SchCfg, uint16_t pci, uint8_t offsetPointA)
+uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots,SchPdcchConfigSib1 *pdcchCfgSib1,\
+               SchSib1Cfg *sib1SchCfg, uint16_t pci, uint8_t offsetPointA, uint16_t sib1PduLen)
 {
    uint8_t coreset0Idx = 0;
    uint8_t searchSpace0Idx = 0;
@@ -622,8 +593,8 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1C
    pdcch = &(sib1SchCfg->sib1PdcchCfg);
    bwp = &(sib1SchCfg->bwp);
 
-   coreset0Idx     = sib1SchCfg->coresetZeroIndex;
-   searchSpace0Idx = sib1SchCfg->searchSpaceZeroIndex;
+   coreset0Idx     = pdcchCfgSib1->coresetZeroIndex;
+   searchSpace0Idx = pdcchCfgSib1->searchSpaceZeroIndex;
 
    /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */
    //ssbMuxPattern = coresetIdxTable[coreset0Idx][0];
@@ -714,10 +685,10 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1C
    {
       pdsch->codeword[cwCount].targetCodeRate = 308;
       pdsch->codeword[cwCount].qamModOrder = 2;
-      pdsch->codeword[cwCount].mcsIndex = sib1SchCfg->sib1Mcs;
+      pdsch->codeword[cwCount].mcsIndex = DEFAULT_MCS;
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
-      tbSize = schCalcTbSize(sib1SchCfg->sib1PduLen + TX_PAYLOAD_HDR_LEN);
+      tbSize = schCalcTbSize(sib1PduLen + TX_PAYLOAD_HDR_LEN);
       pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId                   = pci;
@@ -737,7 +708,7 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1C
    pdsch->pdschFreqAlloc.resourceAllocType   = 1; /* RAT type-1 RIV format */
    /* the RB numbering starts from coreset0, and PDSCH is always above SSB */
    pdsch->pdschFreqAlloc.startPrb  = offsetPointA + SCH_SSB_NUM_PRB;
-   pdsch->pdschFreqAlloc.numPrb    = schCalcNumPrb(tbSize,sib1SchCfg->sib1Mcs, NUM_PDSCH_SYMBOL);
+   pdsch->pdschFreqAlloc.numPrb    = schCalcNumPrb(tbSize, DEFAULT_MCS, NUM_PDSCH_SYMBOL);
    pdsch->pdschFreqAlloc.vrbPrbMapping       = 0; /* non-interleaved */
    pdsch->pdschTimeAlloc.rowIndex            = 1;
    /* This is Intel's requirement. PDSCH should start after PDSCH DRMS symbol */
@@ -787,9 +758,9 @@ uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
    cellCb->macInst = pst->srcInst;
 
    /* derive the SIB1 config parameters */
-   ret = fillSchSib1Cfg(schCellCfg->numerology, schCellCfg->bandwidth, cellCb->numSlots,
-        &(schCellCfg->sib1SchCfg), schCellCfg->phyCellId,
-        schCellCfg->ssbSchCfg.ssbOffsetPointA);
+   ret = fillSchSib1Cfg(schCellCfg->numerology, schCellCfg->dlBandwidth, cellCb->numSlots,
+        &(schCellCfg->pdcchCfgSib1), &(cellCb->sib1SchCfg), schCellCfg->phyCellId,
+        schCellCfg->dlCfgCommon.schFreqInfoDlSib.offsetToPointA, schCellCfg->sib1PduLen);
    
    if(ret != ROK)
    {
@@ -800,28 +771,40 @@ uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
    schProcPagingCfg(cellCb);
 
    /* Fill coreset frequencyDomainResource bitmap */
-   coreset0Idx = cellCb->cellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
+   coreset0Idx = cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
    numRbs = coresetIdxTable[coreset0Idx][1];
    offset = coresetIdxTable[coreset0Idx][3];
-   fillCoresetFeqDomAllocMap(((cellCb->cellCfg.ssbSchCfg.ssbOffsetPointA - offset)/6), (numRbs/6), freqDomainResource);
+   fillCoresetFeqDomAllocMap(((cellCb->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA - offset)/6), \
+                                  (numRbs/6), freqDomainResource);
    covertFreqDomRsrcMapToIAPIFormat(freqDomainResource, \
-      cellCb->cellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc);
+      cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc);
 
    /* Fill K0 - K1 table for common cfg*/ 
-   BuildK0K1Table(cellCb, &cellCb->cellCfg.schInitialDlBwp.k0K1InfoTbl, true, cellCb->cellCfg.schInitialDlBwp.pdschCommon,
-   pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl);
+   BuildK0K1Table(cellCb, &cellCb->k0K1InfoTbl, true, cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon,
+                   pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl);
    
-   BuildK2InfoTable(cellCb, cellCb->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList,\
-   cellCb->cellCfg.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc, &cellCb->cellCfg.schInitialUlBwp.msg3K2InfoTbl, \
-   &cellCb->cellCfg.schInitialUlBwp.k2InfoTbl);
+   BuildK2InfoTable(cellCb, cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList,\
+   cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc, &cellCb->msg3K2InfoTbl, \
+   &cellCb->k2InfoTbl);
+   
+   /*As per Spec 38.211, Sec 6.3.3.2; RootSeq Len(Lra) where Lra=839 or Lra=139,
+    *depending on the PRACH preamble format as given by Tables 6.3.3.1-1 and 6.3.3.1-2.*/
+   if(prachCfgIdxTable[cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.prachCfgIdx][0] <= 3)
+   {
+      cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rootSeqLen = ROOT_SEQ_LEN_1;
+   }
+   else
+   {
+      cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rootSeqLen = ROOT_SEQ_LEN_2;
+   }
    /* Initializing global variables */
    cellCb->actvUeBitMap = 0;
    cellCb->boIndBitMap = 0;
 
-   cellCb->cellCfg.schHqCfg.maxDlDataHqTx = SCH_MAX_NUM_DL_HQ_TX;
-   cellCb->cellCfg.schHqCfg.maxMsg4HqTx = SCH_MAX_NUM_MSG4_TX;
-   cellCb->cellCfg.schHqCfg.maxUlDataHqTx = SCH_MAX_NUM_UL_HQ_TX;
-   cellCb->cellCfg.schRachCfg.maxMsg3Tx = SCH_MAX_NUM_MSG3_TX;
+   cellCb->schHqCfg.maxDlDataHqTx = SCH_MAX_NUM_DL_HQ_TX;
+   cellCb->schHqCfg.maxMsg4HqTx = SCH_MAX_NUM_MSG4_TX;
+   cellCb->schHqCfg.maxUlDataHqTx = SCH_MAX_NUM_UL_HQ_TX;
+   cellCb->maxMsg3Tx = SCH_MAX_NUM_MSG3_TX;
 
    cellCb->schAlgoType = SCH_FCFS;
    cellCb->api = &schCb[inst].allApis[cellCb->schAlgoType]; /* For FCFS */
@@ -897,7 +880,7 @@ uint8_t SchSendCellDeleteRspToMac(SchCellDeleteReq  *ueDelete, Inst inst, SchMac
  * ****************************************************************/
 void deleteSchCellCb(SchCellCb *cellCb)
 {
-   uint8_t sliceIdx=0, slotIdx=0;
+   uint8_t sliceIdx=0, slotIdx=0, plmnIdx = 0;
    CmLListCp *list=NULL;
    CmLList *node=NULL, *next=NULL;
    SchPageInfo *tempNode = NULLP;
@@ -938,16 +921,18 @@ void deleteSchCellCb(SchCellCb *cellCb)
       SCH_FREE(cellCb->schUlSlotInfo,  cellCb->numSlots * sizeof(SchUlSlotInfo*));
    }
 
-   if(cellCb->cellCfg.plmnInfoList.snssai)
+   for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
    {
-      for(sliceIdx=0; sliceIdx<cellCb->cellCfg.plmnInfoList.numSliceSupport; sliceIdx++)
+      if(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai)
       {
-         SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
+         for(sliceIdx=0; sliceIdx<cellCb->cellCfg.plmnInfoList[plmnIdx].numSliceSupport; sliceIdx++)
+         {
+            SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
+         }
+         SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].numSliceSupport*sizeof(Snssai*));
       }
-      SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai, cellCb->cellCfg.plmnInfoList.numSliceSupport*sizeof(Snssai*));
    }
-   
-   SCH_FREE(cellCb->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg));
+   SCH_FREE(cellCb->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg));
 
    for(uint16_t idx =0; idx<MAX_SFN; idx++)
    {
@@ -1307,18 +1292,18 @@ uint8_t allocatePrbDl(SchCellCb *cell, SlotTimingInfo slotTime, \
 
       if(ssbOccasion && sib1Occasion)
       {
-         broadcastPrbStart = cell->cellCfg.ssbSchCfg.ssbOffsetPointA; 
-         broadcastPrbEnd = broadcastPrbStart + SCH_SSB_NUM_PRB + cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
+         broadcastPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA; 
+         broadcastPrbEnd = broadcastPrbStart + SCH_SSB_NUM_PRB + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
       }
       else if(ssbOccasion)
       {
-         broadcastPrbStart = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
+         broadcastPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA;
          broadcastPrbEnd = broadcastPrbStart + SCH_SSB_NUM_PRB -1;
       }
       else if(sib1Occasion)
       {
-         broadcastPrbStart = cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.startPrb;
-         broadcastPrbEnd = broadcastPrbStart + cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
+         broadcastPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.startPrb;
+         broadcastPrbEnd = broadcastPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
       }
 
       /* Iterate through all free PRB blocks */
@@ -1450,7 +1435,7 @@ uint8_t allocatePrbUl(SchCellCb *cell, SlotTimingInfo slotTime, \
       isPrachOccasion = schCheckPrachOcc(cell, slotTime);
       if(isPrachOccasion)
       {
-         prachStartPrb =  cell->cellCfg.schRachCfg.msg1FreqStart;
+         prachStartPrb =  cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1FreqStart;
          prachNumPrb = schCalcPrachNumRb(cell);
          prachEndPrb = prachStartPrb + prachNumPrb -1;
       }
@@ -1584,19 +1569,19 @@ uint16_t searchLargestFreeBlock(SchCellCb *cell, SlotTimingInfo slotTime,uint16_
       checkOccasion = TRUE;
       if(ssbOccasion && sib1Occasion)
       {
-         reservedPrbStart = cell->cellCfg.ssbSchCfg.ssbOffsetPointA; 
+         reservedPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA; 
          reservedPrbEnd = reservedPrbStart + SCH_SSB_NUM_PRB + \
-                          cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
+                          cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
       }
       else if(ssbOccasion)
       {
-         reservedPrbStart = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
+         reservedPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA;
          reservedPrbEnd = reservedPrbStart + SCH_SSB_NUM_PRB -1;
       }
       else if(sib1Occasion)
       {
-         reservedPrbStart = cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.startPrb;
-         reservedPrbEnd = reservedPrbStart + cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
+         reservedPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.startPrb;
+         reservedPrbEnd = reservedPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc.numPrb -1;
       }
       else
       {
@@ -1611,7 +1596,7 @@ uint16_t searchLargestFreeBlock(SchCellCb *cell, SlotTimingInfo slotTime,uint16_
       checkOccasion = schCheckPrachOcc(cell, slotTime);
       if(checkOccasion)
       {
-         reservedPrbStart =  cell->cellCfg.schRachCfg.msg1FreqStart;
+         reservedPrbStart =  cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1FreqStart;
          reservedPrbEnd = reservedPrbStart + (schCalcPrachNumRb(cell)) -1;
       }
    }
@@ -1720,7 +1705,7 @@ void SchSendSliceCfgRspToMac(Inst inst, SchSliceCfgRsp sliceCfgRsp)
 uint8_t fillSliceCfgRsp(bool sliceRecfg, SchSliceCfg *storedSliceCfg, SchCellCb *cellCb, SchSliceCfgReq *schSliceCfgReq, SchSliceCfgRsp *schSliceCfgRsp, uint8_t *count)
 {
    bool sliceFound = false;
-   uint8_t cfgIdx = 0, sliceIdx = 0;
+   uint8_t cfgIdx = 0, sliceIdx = 0, plmnIdx = 0;
 
    schSliceCfgRsp->numSliceCfgRsp  = schSliceCfgReq->numOfConfiguredSlice;
    SCH_ALLOC(schSliceCfgRsp->listOfSliceCfgRsp, schSliceCfgRsp->numSliceCfgRsp * sizeof(SliceRsp*));
@@ -1729,19 +1714,26 @@ uint8_t fillSliceCfgRsp(bool sliceRecfg, SchSliceCfg *storedSliceCfg, SchCellCb
       DU_LOG("\nERROR  --> SCH : Memory allocation failed at fillSliceCfgRsp");
       return RFAILED;
    }
-   
+
    for(cfgIdx = 0; cfgIdx<schSliceCfgRsp->numSliceCfgRsp ; cfgIdx++)
    {
       sliceFound = false;
       /* Here comparing the slice cfg request with the slice stored in cellCfg */
       if(sliceRecfg != true)
       {
-         for(sliceIdx = 0; sliceIdx<cellCb->cellCfg.plmnInfoList.numSliceSupport; sliceIdx++)
+         for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
          {
-            if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai)))
+            for(sliceIdx = 0; sliceIdx<cellCb->cellCfg.plmnInfoList[plmnIdx].numSliceSupport; sliceIdx++)
+            {
+               if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)))
+               {
+                  (*count)++;
+                  sliceFound = true;
+                  break;
+               }
+            }
+            if(sliceFound == true)
             {
-               (*count)++;
-               sliceFound = true;
                break;
             }
          }
@@ -1771,7 +1763,7 @@ uint8_t fillSliceCfgRsp(bool sliceRecfg, SchSliceCfg *storedSliceCfg, SchCellCb
          return RFAILED;
       }
 
-      
+
       schSliceCfgRsp->listOfSliceCfgRsp[cfgIdx]->snssai = schSliceCfgReq->listOfSlices[cfgIdx]->snssai;
       if(sliceFound == true)
          schSliceCfgRsp->listOfSliceCfgRsp[cfgIdx]->rsp    = RSP_OK;
@@ -2081,10 +2073,10 @@ uint8_t SchProcSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq)
  *************************************************************************/
 void schProcPagingCfg(SchCellCb *cell)
 {
-   PageCfg *pageCfgRcvd = NULL;
+   SchPcchCfg *pageCfgRcvd = NULL;
    uint8_t i_sIdx = 0;
 
-   pageCfgRcvd = &(cell->cellCfg.sib1SchCfg.pageCfg);
+   pageCfgRcvd = &(cell->cellCfg.dlCfgCommon.schPcchCfg);
 
    if(pageCfgRcvd->poPresent == TRUE)
    {
@@ -2126,8 +2118,8 @@ void schProcPagingCfg(SchCellCb *cell)
 void schCfgPdcchMonOccOfPO(SchCellCb *cell)
 {
    uint8_t         cnt = 0, incr = 1, i_sIdx = 0, frameOffSet = 0;
-   uint8_t         nsValue = cell->cellCfg.sib1SchCfg.pageCfg.numPO;
-   uint8_t         totalNumSsb = cell->cellCfg.ssbSchCfg.totNumSsb;
+   uint8_t         nsValue = cell->cellCfg.dlCfgCommon.schPcchCfg.numPO;
+   uint8_t         totalNumSsb = countSetBits(cell->cellCfg.ssbPosInBurst[0]);
    SlotTimingInfo  tmpTimingInfo, pdcchTime; 
 
    /*Starting with First Sfn and slot*/
@@ -2266,7 +2258,7 @@ uint8_t SchProcPagingInd(Pst *pst,  SchPageInd *pageInd)
       }
       if(cellCb)
       {
-         if(pageInd->i_s > cellCb->cellCfg.sib1SchCfg.pageCfg.numPO)
+         if(pageInd->i_s > cellCb->cellCfg.dlCfgCommon.schPcchCfg.numPO)
          {
             DU_LOG("\nERROR --> SCH : SchProcPagingInd(): i_s should not be greater than number of paging occasion");
          }
index 8bb6311..353c89c 100644 (file)
@@ -68,6 +68,8 @@
 #define HQ_ACK 0
 #define HQ_NACK 1
 #define HQ_DTX 2
+#define ROOT_SEQ_LEN_1 139
+#define ROOT_SEQ_LEN_2 839
 
 #ifdef NR_DRX
 /* As per 38.331 the largest offset which can be used in of size 10240.
@@ -135,6 +137,15 @@ typedef enum
    HQ_TB_WAITING
 }SchHqTbState;
 
+#ifdef NR_TDD
+typedef enum
+{
+   DL_SLOT,
+   UL_SLOT,
+   FLEXI_SLOT
+}SlotConfig;
+#endif
+
 /*Following structures to keep record and estimations of PRB allocated for each
  * LC taking into consideration the RRM policies*/
 typedef struct lcInfo
@@ -562,6 +573,23 @@ typedef struct schAllApis
    uint8_t (* SchScheduleUlLc)(SlotTimingInfo dciTime, SlotTimingInfo puschTime, uint8_t startStmb, \
       uint8_t symbLen, bool isRetx, SchUlHqProcCb **hqP);
 }SchAllApis;
+
+typedef struct schHqCfgParam
+{
+   uint8_t maxDlDataHqTx;
+   uint8_t maxMsg4HqTx;
+   uint8_t maxUlDataHqTx;
+}SchHqCfg;
+
+typedef struct
+{
+   /* parameters derived in scheduler */
+   uint8_t   n0;
+   BwpCfg    bwp;
+   PdcchCfg  sib1PdcchCfg;
+   PdschCfg  sib1PdschCfg;
+}SchSib1Cfg;
+
 /**
  * @brief
  * Cell Control block per cell.
@@ -590,7 +618,7 @@ typedef struct schCellCb
 #ifdef NR_TDD
    uint8_t       numSlotsInPeriodicity;             /*!< number of slots in configured periodicity and SCS */
    uint32_t      slotFrmtBitMap;                    /*!< 2 bits must be read together to determine D/U/S slots. 00-D, 01-U, 10-S */
-   uint32_t      symbFrmtBitMap;                    /*!< 2 bits must be read together to determine D/U/S symbols. 00-D, 01-U, 10-S */
+   uint8_t       slotCfg[MAX_TDD_PERIODICITY_SLOTS][MAX_SYMB_PER_SLOT];
 #endif
 #ifdef NR_DRX
    SchDrxCb      drxCb[MAX_DRX_SIZE];                           /*!< Drx cb*/
@@ -598,6 +626,12 @@ typedef struct schCellCb
    SchType       schAlgoType;                       /*!< The scheduler type which the cell is configured with.*/
    SchAllApis    *api;                             /*!< Reference of sch APIs for this cell based on the SchType*/
    void          *schSpcCell;                       /*Ref of Scheduler specific structure*/
+   SchHqCfg             schHqCfg;
+   SchK0K1TimingInfoTbl k0K1InfoTbl;
+   SchK2TimingInfoTbl   msg3K2InfoTbl;
+   SchK2TimingInfoTbl   k2InfoTbl;
+   SchSib1Cfg           sib1SchCfg;       /* SIB1 config */
+   uint8_t              maxMsg3Tx;         /* MAximum num of msg3 tx*/
 }SchCellCb;
 
 
index 8e7b588..6e37417 100644 (file)
@@ -77,7 +77,7 @@ uint8_t schBroadcastSsbAlloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcstA
    }
 
    schDlSlotInfo = cell->schDlSlotInfo[slotTime.slot];
-   ssbStartPrb = cell->cellCfg.ssbSchCfg.ssbOffsetPointA; //+Kssb
+   ssbStartPrb = cell->cellCfg.ssbSubcOffset; //+Kssb
    ssbStartSymb = cell->ssbStartSymbArr[dlBrdcstAlloc->ssbIdxSupported-1]; /*since we are supporting only 1 ssb beam */
 
    /* Assign interface structure */
@@ -138,9 +138,9 @@ uint8_t schBroadcastSib1Alloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcst
    }
    
    dlBrdcstAlloc->crnti = SI_RNTI;
-   dmrs = cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->dmrs;
-   freqAlloc = cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc;
-   timeAlloc = cell->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschTimeAlloc;
+   dmrs = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->dmrs;
+   freqAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschFreqAlloc;
+   timeAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg->pdschTimeAlloc;
    schDlSlotInfo = cell->schDlSlotInfo[slotTime.slot];
 
    /* Find total symbols used including DMRS */
@@ -166,8 +166,8 @@ uint8_t schBroadcastSib1Alloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcst
        return RFAILED;
    }
 
-   memcpy(&dlBrdcstAlloc->sib1Alloc.bwp, &cell->cellCfg.sib1SchCfg.bwp, sizeof(BwpCfg)); 
-   memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
+   memcpy(&dlBrdcstAlloc->sib1Alloc.bwp, &cell->sib1SchCfg.bwp, sizeof(BwpCfg)); 
+   memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
    schDlSlotInfo->sib1Pres = true;
    return ROK;
 }
@@ -433,9 +433,9 @@ uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst in
    {
       /* fill pucch common cfg */
       /* derive pucchResourceSet from schCellCfg */
-      pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
+      pucchCfg = &cell->cellCfg.ulCfgCommon.schInitialUlBwp.pucchCommon;
       pucchIdx = pucchCfg->pucchResourceCommon;
-      ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
+      ulBwp = &cell->cellCfg.ulCfgCommon.schInitialUlBwp.bwp;
       startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
       ret = allocatePrbUl(cell, slotInfo, pucchResourceSet[pucchIdx][1], pucchResourceSet[pucchIdx][2],\
             &startPrb, PUCCH_NUM_PRB_FORMAT_0_1_4);
@@ -585,7 +585,7 @@ uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueI
    }
 
    msg4Alloc = &dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo];
-   initialBwp   = &cell->cellCfg.schInitialDlBwp;
+   initialBwp   = &cell->cellCfg.dlCfgCommon.schInitialDlBwp;
    pdcch = &msg4Alloc->dlMsgPdcchCfg;
    pdsch = &msg4Alloc->dlMsgPdschCfg;
    bwp = &msg4Alloc->bwp;
@@ -618,7 +618,7 @@ uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueI
    pdcch->coresetCfg.startSymbolIndex = firstSymbol;
    pdcch->coresetCfg.durationSymbols = numSymbols;
    memcpy(pdcch->coresetCfg.freqDomainResource, \
-      cell->cellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+      cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
 
    pdcch->coresetCfg.cceRegMappingType = 1; /* coreset0 is always interleaved */
    pdcch->coresetCfg.regBundleSize = 6;    /* spec-38.211 sec 7.3.2.2 */
@@ -809,8 +809,8 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c
    /* fill BWP */
    bwp->freqAlloc.numPrb = MAX_NUM_RB;
    bwp->freqAlloc.startPrb = 0;
-   bwp->subcarrierSpacing = cell->cellCfg.sib1SchCfg.bwp.subcarrierSpacing;
-   bwp->cyclicPrefix = cell->cellCfg.sib1SchCfg.bwp.cyclicPrefix;
+   bwp->subcarrierSpacing = cell->sib1SchCfg.bwp.subcarrierSpacing;
+   bwp->cyclicPrefix = cell->sib1SchCfg.bwp.cyclicPrefix;
 
    /* fill the PDCCH PDU */
    //Considering coreset1 also starts from same symbol as coreset0
@@ -1072,7 +1072,7 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl)
       /* Initialization the K0K1 structure, total num of slot and calculating the slot pattern length. */
       memset(k0K1InfoTbl, 0, sizeof(SchK0K1TimingInfoTbl));
       k0K1InfoTbl->tblSize = cell->numSlots;
-      totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+      totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
       
       /* Storing time domain resource allocation list based on common or 
        * dedicated configuration availability. */
@@ -1102,7 +1102,8 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl)
          {
             continue;
          }
-         
+        
+         ulSlotPresent = false;
          /* Storing K0 , start symbol and length symbol for further processing.
           * If K0 value is not available then we can fill the default values
           * given in spec 38.331. */
@@ -1143,14 +1144,21 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl)
             {
                for(checkSymbol = startSymbol; checkSymbol<endSymbol; checkSymbol ++)
                {
-                  slotCfg = cell->cellCfg.tddCfg.slotCfg[tmpSlot][checkSymbol];
+                  slotCfg = cell->slotCfg[tmpSlot][checkSymbol];
                   if(slotCfg == UL_SLOT)
                   {
-                     continue;
+                     ulSlotPresent = true;
+                     break;
                   }
                }
+               if(ulSlotPresent == true)
+               {
+                  continue;
+               }
             }
 
+             ulSlotPresent = false; //Re-initializing
+
             /* If current slot + k0 + k1 is a DL slot then skip the slot
              * else if it is UL slot then store the information 
              * else if it is FLEXI slot then check the symbols, it must have
@@ -1171,7 +1179,7 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl)
                   {
                      for(checkSymbol = 0; checkSymbol< MAX_SYMB_PER_SLOT;checkSymbol++)
                      {
-                        if(cell->cellCfg.tddCfg.slotCfg[tmpSlot][checkSymbol] == UL_SLOT)
+                        if(cell->slotCfg[tmpSlot][checkSymbol] == UL_SLOT)
                         {
                            ulSlotPresent = true;
                            break;
@@ -1294,7 +1302,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
       k2InfoTbl->tblSize = cell->numSlots;
       if(msg3K2InfoTbl)
          msg3K2InfoTbl->tblSize = cell->numSlots;
-      totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+      totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
 
       /* Checking all possible indexes for K2. */
       for(slotIdx = 0; slotIdx < cell->numSlots; slotIdx++)
@@ -1312,7 +1320,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
                k2Val = timeDomRsrcAllocList[k2Index].k2;
                if(!k2Val)
                {
-                  switch(cell->cellCfg.ssbSchCfg.scsCommon)
+                  switch(cell->cellCfg.scsCommon)
                   {
                      case SCS_15KHZ:
                         k2Val = DEFAULT_K2_VALUE_FOR_SCS15;
@@ -1343,7 +1351,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
                      dlSymbolPresent = false;
                      for(checkSymbol= startSymbol; checkSymbol<endSymbol; checkSymbol++)
                      {
-                        currentSymbol = cell->cellCfg.tddCfg.slotCfg[k2TmpVal][checkSymbol];
+                        currentSymbol = cell->slotCfg[k2TmpVal][checkSymbol];
                         if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT)
                         {
                            dlSymbolPresent = true;
@@ -1379,7 +1387,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
                         dlSymbolPresent = false;
                         for(checkSymbol= startSymbol; checkSymbol<endSymbol; checkSymbol++)
                         {
-                           currentSymbol = cell->cellCfg.tddCfg.slotCfg[msg3K2TmpVal][checkSymbol];
+                           currentSymbol = cell->slotCfg[msg3K2TmpVal][checkSymbol];
                            if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT)
                            {
                               dlSymbolPresent = true;
@@ -1951,7 +1959,7 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
       if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt)
          k2InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2InfoTbl;
       else
-         k2InfoTbl =  &cell->cellCfg.schInitialUlBwp.k2InfoTbl;
+         k2InfoTbl =  &cell->k2InfoTbl;
 
       for(k2TblIdx = 0; k2TblIdx < k2InfoTbl->k2TimingInfo[dciTime.slot].numK2; k2TblIdx++)
       {
@@ -1959,9 +1967,9 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
 
          if(!ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt)
          {
-            k2Val = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-            startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol;
-            symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength;
+            k2Val = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
+            startSymb = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol;
+            symbLen = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength;
          }
          else
          {
@@ -2229,15 +2237,15 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S
       if(!msg3HqProc)
          return false;
 
-      numK2 = cell->cellCfg.schInitialUlBwp.k2InfoTbl.k2TimingInfo[dlTime].numK2;
-      msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+      numK2 = cell->k2InfoTbl.k2TimingInfo[dlTime].numK2;
+      msg3K2InfoTbl = &cell->msg3K2InfoTbl;
       msg3MinSchTime = 0;
       msg3Delta = 0;
    }
    else
    {
-      numK2 = cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl.k2TimingInfo[dlTime].numK2;
-      msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.k2InfoTbl;
+      numK2 = cell->msg3K2InfoTbl.k2TimingInfo[dlTime].numK2;
+      msg3K2InfoTbl = &cell->k2InfoTbl;
       msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
       msg3Delta = puschDeltaTable[puschMu];
    }
@@ -2246,11 +2254,11 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S
    {
       k2Index = msg3K2InfoTbl->k2TimingInfo[dlTime].k2Indexes[k2TblIdx];
 
-      k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
+      k2 = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
       if (isRetx)
       {
-         if ((msg3HqProc->strtSymbl != cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol) ||
-            (msg3HqProc->numSymbl != cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength))
+         if ((msg3HqProc->strtSymbl != cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol) ||
+            (msg3HqProc->numSymbl != cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength))
          {
             continue;
          }
index fe17fdd..3730988 100644 (file)
@@ -57,7 +57,7 @@ uint8_t SchProcCrcInd(Pst *pst, CrcIndInfo *crcInd)
          if (crcInd->crcInd[count])
          {
             /* failure case*/
-            if (cell->raCb[ueId-1].msg3HqProc.tbInfo.txCntr < cell->cellCfg.schRachCfg.maxMsg3Tx)
+            if (cell->raCb[ueId-1].msg3HqProc.tbInfo.txCntr < cell->maxMsg3Tx)
             {
                cell->api->SchCrcInd(cell, ueId);
                cell->raCb[ueId - 1].retxMsg3HqProc = &cell->raCb[ueId - 1].msg3HqProc;
index 455cc87..1ec31bc 100644 (file)
@@ -52,7 +52,7 @@ void schDlHqAddToFreeList(SchDlHqProcCb *hqP);
 void schDlHqEntInit(SchCellCb *cellCb, SchUeCb *ueCb)
 {
    ueCb->dlHqEnt.numHqPrcs = SCH_MAX_NUM_DL_HQ_PROC;
-   ueCb->dlHqEnt.maxHqTx  = cellCb->cellCfg.schHqCfg.maxDlDataHqTx;
+   ueCb->dlHqEnt.maxHqTx  = cellCb->schHqCfg.maxDlDataHqTx;
    ueCb->dlHqEnt.cell = cellCb;
    ueCb->dlHqEnt.ue =ueCb;
    schDlHqEntReset(cellCb, ueCb, &ueCb->dlHqEnt);
@@ -343,7 +343,7 @@ void schMsg4FeedbackUpdate(SchDlHqProcCb *hqP, uint8_t fdbk)
    }
    else
    {
-      if( hqP->tbInfo[0].txCntr >= hqP->hqEnt->cell->cellCfg.schHqCfg.maxMsg4HqTx)
+      if( hqP->tbInfo[0].txCntr >= hqP->hqEnt->cell->schHqCfg.maxMsg4HqTx)
       {
          schDlReleaseHqProcess(hqP);
          hqP->hqEnt->ue->msg4HqProc = NULLP;
index c907655..343859a 100644 (file)
@@ -49,7 +49,7 @@ void schUlHqAddToFreeList(SchUlHqProcCb *hqP);
 void schUlHqEntInit(SchCellCb *cellCb, SchUeCb *ueCb)
 {
    ueCb->ulHqEnt.numHqPrcs = SCH_MAX_NUM_UL_HQ_PROC;
-   ueCb->ulHqEnt.maxHqTx  = cellCb->cellCfg.schHqCfg.maxUlDataHqTx;
+   ueCb->ulHqEnt.maxHqTx  = cellCb->schHqCfg.maxUlDataHqTx;
    ueCb->ulHqEnt.cell = cellCb;
    ueCb->ulHqEnt.ue =ueCb;
    schUlHqEntReset(cellCb, ueCb, &ueCb->ulHqEnt);
index 7f6ab32..ed8414b 100644 (file)
@@ -65,7 +65,7 @@ bool schCheckPrachOcc(SchCellCb *cell, SlotTimingInfo prachOccasionTimingInfo)
    uint8_t  subFrame = 0;
    uint16_t prachSubframe = 0;
 
-   prachCfgIdx      = cell->cellCfg.schRachCfg.prachCfgIdx;
+   prachCfgIdx      = cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.prachCfgIdx;
 
    /* derive the prachCfgIdx table paramters */
    x                = prachCfgIdxTable[prachCfgIdx][1];
@@ -109,12 +109,12 @@ bool schCheckPrachOcc(SchCellCb *cell, SlotTimingInfo prachOccasionTimingInfo)
 uint8_t schCalcPrachNumRb(SchCellCb *cell)
 {
    uint8_t tableIdx = 0;
-   uint16_t puschScs = convertScsEnumValToScsVal(cell->cellCfg.schInitialUlBwp.bwp.scs);
+   uint16_t puschScs = convertScsEnumValToScsVal(cell->cellCfg.ulCfgCommon.schInitialUlBwp.bwp.scs);
 
    for(tableIdx=0; tableIdx < MAX_RACH_NUM_RB_IDX; tableIdx++)
    {
-      if((numRbForPrachTable[tableIdx][0] == cell->cellCfg.schRachCfg.rootSeqLen) &&
-            (numRbForPrachTable[tableIdx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing) &&
+      if((numRbForPrachTable[tableIdx][0] == cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rootSeqLen) &&
+            (numRbForPrachTable[tableIdx][1] == cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.msg1SubcSpacing) &&
             (numRbForPrachTable[tableIdx][2] == puschScs))
       {
          return numRbForPrachTable[tableIdx][3];
@@ -158,7 +158,7 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotTimingInfo
    if(!schCheckPrachOcc(cell, prachOccasionTimingInfo))
       return;
 
-   prachCfgIdx      = cell->cellCfg.schRachCfg.prachCfgIdx;
+   prachCfgIdx      = cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.prachCfgIdx;
    prachFormat      = prachCfgIdxTable[prachCfgIdx][0];
    prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
    prachOcas        = prachCfgIdxTable[prachCfgIdx][6];
@@ -166,10 +166,10 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotTimingInfo
 
    /* numRa determined as 𝑛 belonging {0,1,.., M − 1},
     * where M is given by msg1Fdm */
-   numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
+   numRa = (cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1Fdm - 1);
 
    /* freq domain resource determination for RACH*/
-   freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
+   freqStart = cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1FreqStart;
    numPrachRb = schCalcPrachNumRb(cell);
    /* Allocate PRACH resources from the UL resource bitmap */
    allocatePrbUl(cell, prachOccasionTimingInfo, prachStartSymbol, prachDuration, &freqStart, numPrachRb);
@@ -265,8 +265,8 @@ uint8_t SchProcRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq)
        * Preamble index from 0 to (numCbPreamblePerSsb-1) is used for CBRA 
        * Preamble index from numCbPreamblePerSsb to totalNumOfRAPreamble
        * is used for CFRA */
-      firstCFPreambleIndex = cellCb->cellCfg.schRachCfg.numCbPreamblePerSsb;
-      lastCFPreambleIndex = cellCb->cellCfg.schRachCfg.totalNumRaPreamble;
+      firstCFPreambleIndex = cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.numCbPreamblePerSsb;
+      lastCFPreambleIndex = cellCb->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.totalNumRaPreamble;
 
       /* Allocate resource for each SSB index requested */
       for(ssbIdx = 0; ssbIdx < schRachRsrcReq->numSsb; ssbIdx++)
@@ -427,8 +427,8 @@ SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, S
    }
 
    /* Allocate time-domain and frequency-domain resource for MSG3 PUSCH */
-   startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol;
-   symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength;
+   startSymb = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol;
+   symbLen = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength;
 
    startRb = MAX_NUM_RB;
    tbSize = schCalcTbSize(8); /* 6 bytes msg3 and 2 bytes header */
@@ -555,12 +555,12 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
    RaRspWindowStatus    windowStatus=0;
    
 #ifdef NR_TDD
-   totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+   totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
 #endif
-   k0K1InfoTbl    = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+   k0K1InfoTbl    = &cell->k0K1InfoTbl;
    if(cell->raReq[ueId-1]->isCFRA == false)
    {
-      msg3K2InfoTbl  = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+      msg3K2InfoTbl  = &cell->msg3K2InfoTbl;
       puschMu        = cell->cellCfg.numerology;
       msg3Delta      = puschDeltaTable[puschMu];
       msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
@@ -589,7 +589,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
          for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
          {
             k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
-            k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+            k0 = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
 
             /* Calculating time frame to send RAR PDSCH */
             ADD_DELTA_TO_TIME(dciTime, rarTime, k0, cell->numSlots);
@@ -634,7 +634,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
                for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
                {
                   k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
-                  k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
+                  k2 = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
 
                   /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
                   k2 = k2 + msg3Delta;
@@ -705,7 +705,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
          msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time, &(cell->raCb[ueId-1].msg3HqProc), FALSE);
          if(msg3PuschInfo)
          {
-            dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
+            dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.numPrb;
             /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
             dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
             dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.resAlloc.type1.startPrb;
@@ -827,7 +827,7 @@ uint8_t SchProcRachInd(Pst *pst, RachIndInfo *rachInd)
   
    /* Converting window size from ms to number of slots */
    slotDuration = (1 / pow(2, cell->cellCfg.numerology));
-   winNumSlots = (float)cell->cellCfg.schRachCfg.raRspWindow / slotDuration;
+   winNumSlots = (float)cell->cellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.raRspWindow / slotDuration;
    
    /* Adding window size to window start time to get window end time */
    ADD_DELTA_TO_TIME(raReq->winStartTime, raReq->winEndTime, winNumSlots, cell->numSlots);
@@ -862,7 +862,7 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl
    uint16_t numRbs = 0;
    uint16_t tbSize = 0;
 
-   SchBwpDlCfg *initialBwp = &cell->cellCfg.schInitialDlBwp;
+   SchBwpDlCfg *initialBwp = &cell->cellCfg.dlCfgCommon.schInitialDlBwp;
    PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
    PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
    BwpCfg *bwp = &rarAlloc->bwp;
@@ -893,7 +893,7 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl
    pdcch->coresetCfg.startSymbolIndex = firstSymbol;
    pdcch->coresetCfg.durationSymbols = numSymbols;
    memcpy(pdcch->coresetCfg.freqDomainResource, \
-      cell->cellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+      cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
 
    pdcch->coresetCfg.cceRegMappingType = 1; /* coreset0 is always interleaved */
    pdcch->coresetCfg.regBundleSize = 6;    /* spec-38.211 sec 7.3.2.2 */
index 3b0bf5d..cd425b8 100644 (file)
@@ -320,7 +320,7 @@ PduTxOccsaion schCheckSsbOcc(SchCellCb *cell, SlotTimingInfo slotTime)
 {
    uint8_t  ssb_rep;
 
-   ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
+   ssb_rep = cell->cellCfg.ssbPeriod;
 
    /* Identify SSB ocassion*/
    if ((slotTime.sfn % SCH_MIB_TRANS == 0) && (slotTime.slot ==0))
@@ -363,7 +363,7 @@ PduTxOccsaion schCheckSib1Occ(SchCellCb *cell, SlotTimingInfo slotTime)
    }
    else if(cell->firstSib1Transmitted) 
    {
-      if((slotTime.sfn % (cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod/10) == 0) &&
+      if((slotTime.sfn % (SIB1_REPETITION_PERIOD/10) == 0) &&
             (slotTime.slot == 0))
       {
          return REPEATITION;
@@ -423,7 +423,7 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
    }
    else
    {
-      k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+      k0K1InfoTbl = &cell->k0K1InfoTbl;
    }
 
    numK0 = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].numK0;
@@ -432,9 +432,9 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
       k0Index = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k0Index;
       if(dedMsg != true)
       {
-         k0Val = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
-         *pdschStartSymbol = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
-         *pdschSymblLen = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;
+         k0Val = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+         *pdschStartSymbol = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
+         *pdschSymblLen = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;
       }
       else
       {
@@ -553,11 +553,11 @@ uint8_t schProcDlPageAlloc(SchCellCb *cell, SlotTimingInfo currTime, Inst schIns
          break;
       }
       /*Fill PDCCH: PDCCH Cfg is same as SIB1 as Paging will be a broadcast message*/
-      memcpy(&dlPageAlloc.pagePdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg));
+      memcpy(&dlPageAlloc.pagePdcchCfg, &cell->sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg));
       dlPageAlloc.pagePdcchCfg.dci.rnti = P_RNTI;
 
       /*Fill BWP*/
-      memcpy(&dlPageAlloc.bwp, &cell->cellCfg.sib1SchCfg.bwp, sizeof(BwpCfg)); 
+      memcpy(&dlPageAlloc.bwp, &cell->sib1SchCfg.bwp, sizeof(BwpCfg)); 
 
       /*Fill PDSCH*/
       if(schFillPagePdschCfg(cell, &dlPageAlloc.pagePdschCfg, pdschTime, tbSize, pageInfo->mcs, startPrb) != ROK)
index 8bfa40a..e15981b 100644 (file)
@@ -972,10 +972,10 @@ uint8_t schFillUlDciForMsg3Retx(SchRaCb *raCb, SchPuschInfo *puschInfo, DciInfo
    }
 
    /* fill bwp cfg */
-   dciInfo->bwpCfg.subcarrierSpacing  = cellCb->cellCfg.sib1SchCfg.bwp.subcarrierSpacing;
-   dciInfo->bwpCfg.cyclicPrefix       = cellCb->cellCfg.sib1SchCfg.bwp.cyclicPrefix;
-   dciInfo->bwpCfg.freqAlloc.startPrb = cellCb->cellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb;
-   dciInfo->bwpCfg.freqAlloc.numPrb   = cellCb->cellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb; 
+   dciInfo->bwpCfg.subcarrierSpacing  = cellCb->sib1SchCfg.bwp.subcarrierSpacing;
+   dciInfo->bwpCfg.cyclicPrefix       = cellCb->sib1SchCfg.bwp.cyclicPrefix;
+   dciInfo->bwpCfg.freqAlloc.startPrb = cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.startPrb;
+   dciInfo->bwpCfg.freqAlloc.numPrb   = cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.numPrb; 
 
    /*fill coreset cfg */
    //Considering number of RBs in coreset1 is same as coreset0
@@ -983,7 +983,7 @@ uint8_t schFillUlDciForMsg3Retx(SchRaCb *raCb, SchPuschInfo *puschInfo, DciInfo
    //Considering coreset1 also starts from same symbol as coreset0
    dciInfo->coresetCfg.startSymbolIndex = searchSpaceIdxTable[0][3];
    dciInfo->coresetCfg.durationSymbols  = coresetIdxTable[0][2];
-   memcpy(dciInfo->coresetCfg.freqDomainResource, cellCb->cellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+   memcpy(dciInfo->coresetCfg.freqDomainResource, cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
    
    dciInfo->coresetCfg.cceRegMappingType   = 1; /* coreset0 is always interleaved */
    dciInfo->coresetCfg.regBundleSize       = 6; /* spec-38.211 sec 7.3.2.2 */
@@ -1080,10 +1080,10 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo *puschInfo, DciInfo *dciInfo, b
    dciInfo->crnti  = ueCb->crnti;
 
    /* fill bwp cfg */
-   dciInfo->bwpCfg.subcarrierSpacing  = cellCb->cellCfg.sib1SchCfg.bwp.subcarrierSpacing;
-   dciInfo->bwpCfg.cyclicPrefix       = cellCb->cellCfg.sib1SchCfg.bwp.cyclicPrefix;
-   dciInfo->bwpCfg.freqAlloc.startPrb = cellCb->cellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb;
-   dciInfo->bwpCfg.freqAlloc.numPrb   = cellCb->cellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb; 
+   dciInfo->bwpCfg.subcarrierSpacing  = cellCb->sib1SchCfg.bwp.subcarrierSpacing;
+   dciInfo->bwpCfg.cyclicPrefix       = cellCb->sib1SchCfg.bwp.cyclicPrefix;
+   dciInfo->bwpCfg.freqAlloc.startPrb = cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.startPrb;
+   dciInfo->bwpCfg.freqAlloc.numPrb   = cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.numPrb; 
 
    /*fill coreset cfg */
    //Considering number of RBs in coreset1 is same as coreset0
index 785956c..444db96 100644 (file)
 
 #include "common_def.h"
 
+/*Spec 38.104, Table 5.4.2.1-1 ARFCN - FREQ mapping*/
+/*{  F_REF(Mhz), ΔF_Global, F_REF-Offs, N_REF-offs, Range of N_REF }*/
+uint32_t arfcnFreqTable[3][5] = {
+  {   3000,   5,         0,        0,   599999 }, /*index 0*/
+  {  24250,  15,      3000,   600000,  2016666 }, /*index 1*/
+  { 100000,  60,  24250.08,  2016667,  3279165 }, /*index 2*/
+};
+
 /**
  * @brief frequency domain allocation function. 
  *
@@ -417,6 +425,75 @@ uint8_t countSetBits(uint32_t num)
    return(count);
 }
 
+/*******************************************************************
+*
+* @brief  convert ARFCN to freq in kHZ
+*
+* @details
+*
+*    Function : convertArfcnToFreqKhz
+*
+*    Functionality: convert ARFCN to freq in kHZ as per Table below
+*                  3GPP TS 38.104, Table 5.4.2.1-1
+*       Formula: F_REF = F_REF-Offs + ΔF_Global (N_REF – N_REF-Offs)
+*
+* @params[in] uint32_t number
+*
+* @return [out] uint32_t Freq in kHZ
+*
+* ****************************************************************/
+uint32_t convertArfcnToFreqKhz(uint32_t arfcn)
+{
+   uint8_t indexTable = 0;
+   uint32_t freq = 0;
+
+   for(indexTable = 0; indexTable < 4; indexTable++)
+   {
+      if(arfcn <= arfcnFreqTable[indexTable][4])
+      {
+         freq = arfcnFreqTable[indexTable][2] + (arfcnFreqTable[indexTable][1] * (arfcn - arfcnFreqTable[indexTable][3]));
+         return (freq*1000);
+      }
+   }
+   DU_LOG("ERROR  -->  DUAPP: ARFCN vaid range is between 0 and 3279165");
+   return (freq*1000);
+}
+
+
+/*******************************************************************
+*
+* @brief  convert Freq(MHZ) to ARFCN
+*
+* @details
+*
+*    Function : convertFreqToArfcn
+*
+*    Functionality: convert freq to ARFCN as per Table below
+*                  3GPP TS 38.104, Table 5.4.2.1-1
+*       Formula: NREF = NREF-Offs +  (FREF – FREF-Offs) / ΔFGlobal
+*
+* @params[in] uint32_t Freq(MHZ)
+*
+* @return [out] uint32_t ARFCN(number)
+*
+* ****************************************************************/
+uint32_t convertFreqToArfcn(uint32_t freq)
+{
+   uint8_t indexTable = 0;
+   uint32_t arfcn = 0;
+
+   for(indexTable = 0; indexTable < 4; indexTable++)
+   {
+      if(freq < arfcnFreqTable[indexTable][0])
+      {
+         arfcn = arfcnFreqTable[indexTable][3] + ((freq - arfcnFreqTable[indexTable][2]) / (arfcnFreqTable[indexTable][1]));
+         return (arfcn);
+      }
+   }
+   DU_LOG("ERROR  -->  DUAPP: FREQ vaid range is between 0 and 100000 MHz");
+   return (arfcn);
+}
+
 /**********************************************************************
          End of file
 **********************************************************************/
index 9c3d555..4c0a55a 100644 (file)
@@ -240,13 +240,6 @@ typedef enum
 }ConfigType;
 
 #ifdef NR_TDD
-typedef enum
-{
-   DL_SLOT,
-   UL_SLOT,
-   FLEXI_SLOT
-}SlotConfig;
-
 typedef enum
 {
    TX_PRDCTY_MS_0P5,
@@ -330,9 +323,11 @@ typedef struct oduCellId
 #ifdef NR_TDD
 typedef struct tddCfg
 {
-   bool               pres;
-   DlUlTxPeriodicity  tddPeriod;      /* DL UL Transmission periodicity */
-   SlotConfig         slotCfg[MAX_TDD_PERIODICITY_SLOTS][MAX_SYMB_PER_SLOT]; 
+   DlUlTxPeriodicity  tddPeriod;     /*DL UL Transmission periodicity */
+   uint8_t            nrOfDlSlots;   /*No. of consecultive full DL slots at beginning of DL-UL pattern*/
+   uint8_t            nrOfDlSymbols; /*No. of consecultive DL symbol at beginning of slot after last full DL slot*/ 
+   uint8_t            nrOfUlSlots;   /*No. of consecutive full UL slots at the end of each DL-UL pattern*/
+   uint8_t            nrOfUlSymbols; /*No. of consecutive UL symbols in the end of the slot before the first full UL slot*/
 }TDDCfg;
 #endif
 
@@ -354,7 +349,7 @@ Region region, Pool pool, Data **ptr, Size size, uint8_t memType);
 uint8_t SPutStaticBufNewForDebug(char *file, const char *func, int line, \
 Region region, Pool pool, Data *ptr, Size size, uint8_t memType);
 uint8_t countSetBits(uint32_t num);
-
+uint32_t convertArfcnToFreqKhz(uint32_t arfcn);
 #endif
 
 /**********************************************************************
index d9d8bca..8d29801 100644 (file)
@@ -90,6 +90,7 @@
 #define BSR_SR_DELAY_TMR_2560 2560
 
 #define PAGING_SCHED_DELTA  4
+#define MAX_PLMN 2
 
 typedef enum
 {
@@ -152,7 +153,7 @@ typedef enum
 typedef enum
 {
    BETA_PSS_0DB,
-   BETA_PSS_1DB
+   BETA_PSS_3DB
 }BetaPss;
 
 typedef enum 
@@ -531,28 +532,91 @@ typedef struct failureCause
 
 typedef struct carrierCfg
 {
-   bool  pres;
-   uint32_t   bw;             /* DL/UL bandwidth */
-   uint32_t   freq;           /* Absolute frequency of DL/UL point A in KHz */
-   uint16_t   k0[NUM_NUMEROLOGY];          /* K0 for DL/UL */
-   uint16_t   gridSize[NUM_NUMEROLOGY];    /* DL/UL Grid size for each numerologies */
-   uint16_t   numAnt;         /* Number of Tx/Rx antennas */
+   uint32_t   dlBw;                   /* DL bandwidth */
+   uint32_t   dlFreq;                 /* Absolute frequency of DL point A in KHz */
+   uint32_t   ulBw;                   /* UL bandwidth */
+   uint32_t   ulFreq;                 /* Absolute frequency of UL point A in KHz */
+   uint16_t   numTxAnt;               /* Number of Tx antennas */
+   uint16_t   numRxAnt;               /* Number of Rx antennas */
 }CarrierCfg;
 
+typedef enum
+{
+   OP_DISABLED,     
+   OP_ENABLED,     
+}MacOpState;
+
+typedef enum
+{
+   ADMIN_LOCKED,     
+   ADMIN_UNLOCKED,  
+   ADMIN_SHUTTING_DOWN, 
+}MacAdminState;
+
+typedef enum
+{
+   CELL_IDLE,
+   CELL_INACTIVE,
+   CELL_ACTIVE,
+}MacCellState;
+
+typedef struct plmnInfoList
+{
+   Plmn           plmn;
+   uint8_t        numSupportedSlice; /* Total slice supporting */
+   Snssai         **snssai;         /* List of supporting snssai*/
+}PlmnInfoList;
+
+typedef struct schPageCfg
+{
+  uint8_t  numPO;                    /*Derived from Ns*/
+  bool     poPresent;                /*Whether FirstPDCCH-MonitoringPO is present or not*/
+  uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
+}SchPageCfg;
+
+typedef struct pdcchConfigSib1
+{
+   uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
+   uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
+}PdcchConfigSib1;
+
+typedef struct sib1CellCfg
+{
+   PdcchConfigSib1  pdcchCfgSib1;  /*Freq pos where UE may find SS/PBCH block with SIB1*/
+   uint8_t          *sib1Pdu;
+   uint16_t         sib1PduLen;
+   SchPageCfg       pagingCfg;
+} Sib1CellCfg; 
+
+
+typedef struct cellCfg
+{
+   MacOpState      opState;
+   MacAdminState   adminState;
+   MacCellState    cellState;
+   PlmnInfoList plmnInfoList[MAX_PLMN];   /* Consits of PlmnId and Snssai list */
+   uint32_t     phyCellId;                /* Physical cell id */
+   uint32_t     tac;
+   uint32_t     ssbFreq;
+   uint16_t     subCarrSpacing;
+   DuplexMode   dupType;          /* Duplex type: TDD/FDD */
+   uint8_t      numerology;       /* Supported numerology */
+   Sib1CellCfg  sib1Cfg;          /* SIB1 config */
+}CellCfg;
+
 typedef struct ssbCfg
 {
    uint32_t    ssbPbchPwr;       /* SSB block power */
-   BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
    uint8_t     scsCmn;           /* subcarrier spacing for common */
    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
-   BetaPss     betaPss;
    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
    uint8_t     ssbScOffset;       /* Subcarrier Offset */
-   uint8_t     mibPdu[3];           /* MIB payload */
    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
    uint8_t     beamId[NUM_SSB];
-   bool        multCarrBand;     /* Multiple carriers in a band */
-   bool        multCellCarr;     /* Multiple cells in single carrier */
+   BetaPss     betaPss;
+   BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
+   uint8_t     mibPdu[3];           /* MIB payload */
+   uint8_t     dmrsTypeAPos;     /* DMRS Type A position */
 }SsbCfg;
 
 typedef struct fdmInfo
@@ -561,49 +625,25 @@ typedef struct fdmInfo
    uint8_t    numRootSeq;        /* Number of root sequences required for FD */
    uint16_t   k1;                /* Frequency Offset for each FD */
    uint8_t    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
-   uint8_t    numUnusedRootSeq;  /* Number of unused root sequence */
-   uint8_t    *unsuedRootSeq;     /* Unused root sequence per FD */
 }PrachFdmInfo;
 
 typedef struct prachCfg
 {
-   bool          pres;
-   uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
-   RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
-   uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
-   uint8_t       msg1Fdm;             /* PRACH FDM (1,2,4,8) */
-   uint8_t       rootSeqLen;          /* Root sequence length */
+   uint8_t       msg1Fdm;             /* Number of RACH frequency domain occasions/ PRACH FDM (1,2,4,8) */
+   uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
    PrachFdmInfo  fdm[8];              /* FDM info */
-   uint8_t       totalNumRaPreamble;  /* Total number of RA preambles */
+   RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
+   uint8_t       totalNumRaPreamble;  /* Total number of RA preambles */
    uint8_t       numCbPreamblePerSsb; /* Number of CB preamble per SSB */
-   bool          prachMultCarrBand;   /* Multiple carriers in Band */
-   uint8_t       prachRestrictedSet; /* Support for PRACH restricted set */
+   uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
    uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
    uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
    uint8_t       raRspWindow;         /* RA Response Window */
 }PrachCfg;
 
-typedef struct schPageCfg
-{
-  uint8_t  numPO;                    /*Derived from Ns*/
-  bool     poPresent;                /*Whether FirstPDCCH-MonitoringPO is present or not*/
-  uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
-}SchPageCfg;
-
-typedef struct sib1CellCfg
-{
-   uint8_t  *sib1Pdu;
-   uint16_t sib1PduLen;
-   uint16_t sib1RepetitionPeriod;
-   uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
-   uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
-   uint16_t sib1Mcs;
-   SchPageCfg  pagingCfg;
-} Sib1CellCfg; 
-
 typedef struct bwpParams
 {
    uint16_t firstPrb;
@@ -662,11 +702,11 @@ typedef struct pucchConfigCommon
 /* PUSCH Time Domain Resource Allocation */
 typedef struct puschTimeDomRsrcAlloc
 {
-   uint8_t   k2;
+   uint8_t             k2;
    CommonMappingType   mappingType;
-   uint8_t           startSymbol;
-   uint8_t           symbolLength;
-   uint8_t   startSymbolAndLength;
+   uint8_t             startSymbol;
+   uint8_t             symbolLength;
+   uint8_t             startSymbolAndLength;
 }PuschTimeDomRsrcAlloc;
 
 
@@ -679,26 +719,19 @@ typedef struct puschConfigCommon
 
 typedef struct bwpDlConfig
 {
-   BwpParams      bwp;
+   BwpParams         bwp;
    PdcchConfigCommon pdcchCommon;
    PdschConfigCommon pdschCommon;
 }BwpDlConfig;
 
 typedef struct bwpUlConfig
 {
-   BwpParams      bwp;
+   BwpParams         bwp;
    // rach config common sent in PrachCfg
    PucchConfigCommon pucchCommon;
    PuschConfigCommon puschCommon;
 }BwpUlConfig;
 
-typedef struct plmnInfoList
-{
-   Plmn           plmn;
-   uint8_t        numSupportedSlice; /* Total slice supporting */
-   Snssai         **snssai;         /* List of supporting snssai*/
-}PlmnInfoList;
-
 #ifdef NR_DRX
 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
 typedef struct drxOnDurationTimer
@@ -738,28 +771,41 @@ typedef struct drxCfg
 }DrxCfg;
 #endif
 
+typedef struct precodingConf
+{
+   uint16_t numLayers;
+   uint16_t numAntPorts;
+}PrecodingConf;
+
+typedef struct beamformingConf
+{    
+   uint16_t numOfBeams;
+   uint16_t numTxRUs;
+   uint16_t beamIdx;
+   uint16_t beamType;
+   uint32_t beamAzimuth;
+   uint32_t beamTilt;
+   uint32_t beamHorizWidth;
+   uint32_t beamVertWidth;
+   uint32_t coverageShape;
+   uint32_t digitalTilt;
+   uint32_t digitalAzimuth;    
+}BeamformingConf;
+
 typedef struct macCellCfg
 {
-   uint16_t       cellId;           /* Cell Id */
-   uint8_t        carrierId;        /* Carrired Index */
-   uint16_t       phyCellId;        /* Physical cell id */
-   uint8_t        numerology;       /* Supported numerology */
-   DuplexMode     dupType;          /* Duplex type: TDD/FDD */
-   CarrierCfg     dlCarrCfg;        /* DL Carrier configuration */
-   CarrierCfg     ulCarrCfg;        /* UL Carrier configuration */
-   bool           freqShft;         /* Indicates presence of 7.5kHz frequency shift */
-   SsbCfg         ssbCfg;           /* SSB configuration */          
-   PrachCfg       prachCfg;         /* PRACH Configuration */
+   uint16_t         cellId;           /* Cell Id */
+   CarrierCfg       carrCfg;          /* Carrier configuration */
+   CellCfg          cellCfg;          /* Cell Configuration*/
+   SsbCfg           ssbCfg;           /* SSB configuration */          
+   PrachCfg         prachCfg;         /* PRACH Configuration */
 #ifdef NR_TDD
-   TDDCfg         tddCfg;           /* TDD periodicity and slot configuration */
+   TDDCfg           tddCfg;           /* TDD periodicity and slot configuration */
 #endif
-   RSSIMeasUnit   rssiUnit;         /* RSSI measurement unit */
-   Sib1CellCfg    sib1Cfg;          /* SIB1 config */
-   BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
-   BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
-   uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
-   PlmnInfoList   plmnInfoList;     /* Consits of PlmnId and Snssai list */
-   //RrmPolicy      *rrmPolicy;       /* RRM policy details */ 
+   BwpDlConfig      initialDlBwp;     /* Initial DL BWP */
+   BwpUlConfig      initialUlBwp;     /* Initial UL BWP */
+   PrecodingConf    precodingConf;
+   BeamformingConf  beamCfg;
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
index db34fd7..5851797 100644 (file)
 #define DEFAULT_K2_VALUE_FOR_SCS60  2
 #define DEFAULT_K2_VALUE_FOR_SCS120 3 
 
+#define MAX_PLMN 2
+
 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr, numOfSlot)          \
 {                                                          \
    if ((crntTime.slot + incr) > (numOfSlot - 1))           \
@@ -455,20 +457,6 @@ typedef struct resAllocType1
 
 typedef struct resAllocType1 FreqDomainRsrc;
 
-typedef struct
-{
-   uint32_t    ssbPbchPwr;       /* SSB block power */
-   uint8_t     scsCommon;           /* subcarrier spacing for common [0-3]*/
-   uint8_t     ssbOffsetPointA;  /* SSB sub carrier offset from point A */
-   SchSSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
-   uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
-   uint32_t    nSSBMask[SCH_SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
-   
-   /*Ref:Spec 38.331 "ssb-PositionsInBurst", Value 0 in Bitmap => corresponding SS/PBCH block is not transmitted
-    *value 1 => corresponding SS/PBCH block is transmitted*/
-   uint8_t     totNumSsb;       /*S = Total Number of Actual SSB transmitted*/
-}SchSsbCfg;
-
 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-32 BWP Information  */
 typedef struct bwpCfg
 {
@@ -607,47 +595,43 @@ typedef struct pdcchCfg
 } PdcchCfg;
 /* end of SIB1 PDCCH structures */
 
-typedef struct pageCfg
+typedef struct schPcchCfg
 {
    uint8_t  numPO;                    /*Derived from Ns*/
    bool     poPresent;                /*FirstPDCCH-MonitoringPO is present or not*/
    uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
-}PageCfg;
+}SchPcchCfg;
 
-typedef struct
+typedef struct schPdcchConfigSib1
 {
-   /* parameters recieved from DU-APP */
-   uint16_t sib1PduLen;
-   uint16_t sib1RepetitionPeriod;
    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
-   uint16_t sib1Mcs;
-
-   /* parameters derived in scheduler */
-   uint8_t   n0;
-   BwpCfg    bwp;
-   PdcchCfg  sib1PdcchCfg;
-   PageCfg   pageCfg;         /*Config of Paging*/
-}SchSib1Cfg;
+}SchPdcchConfigSib1;
 
-typedef struct schRachCfg
+typedef struct schRachCfgGeneric
 {
    uint8_t      prachCfgIdx;       /* PRACH config idx */
-   uint8_t      prachSubcSpacing;  /* Subcarrier spacing of RACH */
-   uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
-   uint8_t      rootSeqLen;        /* root sequence length */
-   uint16_t     rootSeqIdx;        /* Root sequence index */
-   uint8_t      numRootSeq;        /* Number of root sequences required for FD */
-   uint16_t     k1;                /* Frequency Offset for each FD */
+   uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
+   uint8_t      zeroCorrZoneCfg;   /* Zero correlation zone cofig */
+   int16_t      preambleRcvdTargetPower;
+   uint8_t      preambleTransMax;
+   uint8_t      pwrRampingStep;
+   uint8_t      raRspWindow;       /* RA Response Window */
+}SchRachCfgGeneric;
+
+typedef struct schRachCfg
+{
+   SchRachCfgGeneric  prachCfgGeneric;
    uint8_t      totalNumRaPreamble; /* Total number of RA preambles */
    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
    uint8_t      numCbPreamblePerSsb; /* Number of CB preamble per SSB */
-   uint8_t      prachMultCarrBand; /* Presence of Multiple carriers in Band */
    uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
    uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
-   uint8_t      raRspWindow;       /* RA Response Window */
-   uint8_t      maxMsg3Tx;         /* MAximum num of msg3 tx*/
+   uint16_t     rootSeqIdx;        /* Root sequence index */
+   uint16_t     rootSeqLen;        /* root sequence length */
+   uint8_t      numRootSeq;        /* Number of root sequences required for FD */
+   uint8_t      msg1SubcSpacing;  /* Subcarrier spacing of RACH */
 }SchRachCfg;
 
 typedef struct schBwpParams
@@ -747,7 +731,6 @@ typedef struct schBwpDlCfg
    SchBwpParams   bwp;
    SchPdcchCfgCmn pdcchCommon;
    SchPdschCfgCmn pdschCommon;
-   SchK0K1TimingInfoTbl k0K1InfoTbl;
 }SchBwpDlCfg;
 
 typedef struct schK2TimingInfo
@@ -765,10 +748,9 @@ typedef struct schK2TimingInfoTbl
 typedef struct schBwpUlCfg
 {
    SchBwpParams   bwp;
+   SchRachCfg     schRachCfg;       /* PRACH config */
    SchPucchCfgCmn pucchCommon;
    SchPuschCfgCmn puschCommon;
-   SchK2TimingInfoTbl msg3K2InfoTbl;
-   SchK2TimingInfoTbl k2InfoTbl;
 }SchBwpUlCfg;
 
 typedef struct schPlmnInfoList
@@ -778,13 +760,6 @@ typedef struct schPlmnInfoList
    Snssai         **snssai;         /* List of supporting snssai*/
 }SchPlmnInfoList;
 
-typedef struct schHqCfgParam
-{
-   uint8_t maxDlDataHqTx;
-   uint8_t maxMsg4HqTx;
-   uint8_t maxUlDataHqTx;
-}SchHqCfg;
-
 #ifdef NR_DRX
 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
 
@@ -825,25 +800,99 @@ typedef struct schDrxCfg
 }SchDrxCfg;
 #endif
 
+/*Spec 38.331 'NrNsPmaxList'*/
+typedef struct schNrNsPmaxList
+{
+   long additionalPMax;
+   long additionalSpectrumEmission;
+}SchNrNsPmaxList;
+
+/*Spec 38.331 'FrequencyInfoDL-SIB'*/
+typedef struct schMultiFreqBandListSib
+{
+   long freqBandIndNr;
+   SchNrNsPmaxList nrNsPmaxList[1];
+}SchMultiFreqBandListSib;
+
+/*Spec 38.331 'SCS-SpecificCarrier'*/
+typedef struct schScsSpecificCarrier
+{
+  uint16_t offsetToCarrier;
+  uint8_t  subCarrierSpacing;
+  uint16_t carrierBw;
+  uint16_t txDirectCurrentLoc;
+}SchScsSpecificCarrier;
+
+/*Spec 38.331 'FrequencyInfoDL-SIB'*/
+typedef struct schFreqInfoDlSib
+{
+   SchMultiFreqBandListSib mutiFreqBandList[1];
+   uint16_t                offsetToPointA;
+   SchScsSpecificCarrier   schSpcCarrier[1];
+}SchFreqInfoDlSib;
+
+typedef struct schBcchCfg
+{
+   long modPeriodCoeff;
+}SchBcchCfg;
+
+/*Spec 38.331 'DownlinkConfigCommonSIB'*/
+typedef struct schDlCfgCommon
+{
+   SchFreqInfoDlSib  schFreqInfoDlSib;
+   SchBwpDlCfg       schInitialDlBwp;  /* Initial DL BWP */
+   SchBcchCfg        schBcchCfg;
+   SchPcchCfg        schPcchCfg;
+}SchDlCfgCommon;
+
+/*Spec 38.331 'FrequencyInfoUL-SIB'*/
+typedef struct schFreqInfoUlSib
+{
+   SchMultiFreqBandListSib mutiFreqBandList[1];
+   uint16_t                absoluteFreqPointA;
+   SchScsSpecificCarrier   schSpcCarrier[1];
+   int8_t                  schPMax;
+   bool                    frequencyShift7p5khz;
+}SchFreqInfoUlSib;
+
+/*Spec 38.331 'UplinkConfigCommonSIB '*/
+typedef struct schUlCfgCommon
+{
+   SchFreqInfoUlSib  schFreqInfoUlSib;
+   SchBwpUlCfg       schInitialUlBwp;  /* Initial DL BWP */
+   uint16_t          schTimeAlignTimer;
+}SchUlCfgCommon;
+
+/*Ref: ORAN_WG8.V7.0.0 Sec 11.2.3.2.1*/
 typedef struct schCellCfg
 {
-   uint16_t       cellId;           /* Cell Id */
-   uint16_t       phyCellId;        /* Physical cell id */
-   uint8_t        numerology;       /* Supported numerology */
-   SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
-   uint8_t        bandwidth;        /* Supported B/W */
-   uint32_t       dlFreq;           /* DL Frequency */
-   uint32_t       ulFreq;           /* UL Frequency */
-   SchSsbCfg      ssbSchCfg;        /* SSB config */
-   SchSib1Cfg     sib1SchCfg;       /* SIB1 config */
-   SchRachCfg     schRachCfg;       /* PRACH config */
-   SchBwpDlCfg    schInitialDlBwp;  /* Initial DL BWP */
-   SchBwpUlCfg    schInitialUlBwp;  /* Initial UL BWP */
-   SchPlmnInfoList plmnInfoList;     /* Consits of PlmnId and Snssai list */
-   SchHqCfg       schHqCfg;
+   uint16_t        cellId;                 /* Cell Id */
+   uint8_t         numOfBeams;
+   uint8_t         numLayers;
+   uint8_t         numAntPorts;
+   uint16_t        phyCellId;               /* Physical cell id */
+   SchPlmnInfoList plmnInfoList[MAX_PLMN];  /* Consits of PlmnId and Snssai list */
+   SchDuplexMode   dupMode;                 /* Duplex type: TDD/FDD */
+   uint8_t         numerology;              /* Supported numerology */
+   uint8_t         dlBandwidth;             /* Supported B/W */
+   uint8_t         ulBandwidth;             /* Supported B/W */
+   SchDlCfgCommon  dlCfgCommon;             /*Spec 38.331 DownlinkConfigCommonSIB*/
+   SchUlCfgCommon  ulCfgCommon;             /*Spec 38.331 UplinkConfigCommonSIB*/
 #ifdef NR_TDD
-   TDDCfg         tddCfg;           /* TDD Cfg */ 
+   TDDCfg          tddCfg;                  /* Spec 38.331 tdd-UL-DL-ConfigurationCommon */ 
 #endif 
+
+  /*Ref:Spec 38.331 "ssb-PositionsInBurst", Value 0 in Bitmap => corresponding SS/PBCH block is not transmitted
+    *value 1 => corresponding SS/PBCH block is transmitted*/
+   uint32_t            ssbPosInBurst[SCH_SSB_MASK_SIZE];  /* Bitmap for actually transmitted SSB. */
+   SchSSBPeriod        ssbPeriod;        /* SSB Periodicity in msec */
+   uint32_t            ssbFrequency;     /* SB frequency in kHz*/
+   uint8_t             dmrsTypeAPos;
+   uint8_t             scsCommon;        /* subcarrier spacing for common [0-3]*/
+   SchPdcchConfigSib1  pdcchCfgSib1;      /* Req to configure CORESET#0 and SearchSpace#0*/
+   uint32_t            ssbPbchPwr;       /* SSB block power */
+   uint8_t             ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
+   uint16_t            sib1PduLen;
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
index 619b077..78fb8e9 100644 (file)
@@ -431,21 +431,64 @@ void *cuConsoleHandler(void *args)
       }
       else if(ch == 'm')
       {
-         uint8_t ueId = 1;
-         uint8_t duId = 1;
-         uint8_t duIdx = 0;
+         uint8_t  ueId  = 1;
+         uint8_t  duId  = 0;
+         uint8_t  duIdx = 0;
+         DuDb    *duDb  = NULLP;
+         CuUeCb  *ueCb  = NULLP;
+
+         DU_LOG("\nEnter DU ID whose UE has to be modified");
+         scanf("%d", &duId);
+         DU_LOG("\nEnter UE ID to be modified");
+         scanf("%d", &ueId);
 
          DU_LOG("\nINFO  --> CU_STUB: UE Context Mod for ueId [%d] at DU ID [%d]", \
-                  ueId, duId );
-         DuDb *duDb = NULLP;
-         CuUeCb *ueCb = NULLP;
+                  ueId, duId);
 
          SEARCH_DU_DB(duIdx, duId, duDb); 
          if(duDb)
+         {
             ueCb = &duDb->ueCb[ueId-1];
-         BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE);
+            BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE);
+         }
+         else
+         {
+            DU_LOG("ERROR --> DuDb is NULLP");
+         }
+         continue;
 
       }
+      /*UE context release command from CU*/
+      else if(ch == 'c')
+      {
+         uint32_t duId, cuUeF1apId, duUeF1apId;
+         uint8_t  duIdx = 0;
+         DuDb    *duDb  = NULLP;
+         
+         DU_LOG("\nEnter DU ID on which UE has to be released");
+         scanf("%d", &duId);
+         DU_LOG("\nEnter UE ID to be released");
+         scanf("%d", &duUeF1apId);
+        
+         SEARCH_DU_DB(duIdx, duId, duDb); 
+         if(duDb)
+         {
+            if(duDb->ueCb[duUeF1apId-1].gnbDuUeF1apId == duUeF1apId)
+            {
+               cuUeF1apId = duDb->ueCb[duUeF1apId-1].gnbCuUeF1apId;
+               DU_LOG("INFO   -->  CU_STUB: Cu UeId: %d Du UeId:%d",cuUeF1apId, duUeF1apId);
+               BuildAndSendUeContextReleaseCommand(duId, cuUeF1apId, duUeF1apId);
+            }
+            else
+            {
+               DU_LOG("ERROR  -->  CU_STUB: Du UeId:%d in UeCb mismatch",\
+                        duDb->ueCb[duUeF1apId-1].gnbDuUeF1apId);
+            }
+         }
+
+         sleep(5);
+         continue;
+      }
    }
 }
 /**********************************************************************
index ee1c4f6..7af503f 100644 (file)
@@ -367,7 +367,8 @@ uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
       raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
       setCellOpState(cellId->cellId, ENABLED, ACTIVE);
 #endif
-
+       duCfgParam.macCellCfg.cellCfg.opState = OP_ENABLED;
+       duCfgParam.macCellCfg.cellCfg.cellState = CELL_ACTIVE;
    }
 
    if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
index b5c3173..0daca41 100644 (file)
@@ -77,53 +77,6 @@ char encBuf[ENC_BUF_MAX_LEN];
      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
  */
 
-#ifdef NR_TDD
-/*******************************************************************
- *
- * @brief Fills the Slot configuration 
- *
- * @details
- *
- *    Function : FillSlotConfig
- *
- *    Functionality:Fill the Slot configuration values
- * 
- *  @params[in] void
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-void FillSlotConfig()
-{
-   uint8_t slot = 0;
-   uint8_t symbol =0;
-   
-   memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
-                          MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
-   
-   //Filling the DL Slots and initializing flexi slot
-   for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
-   {
-      for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
-      {
-        duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
-      }
-   }
-  
-   //Filling UL Slots
-   for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
-   {
-      for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
-        duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
-   } 
-   //Updating Flexi Slot
-   slot = NUM_DL_SLOTS;
-   duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
-   duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
-
-}
-#endif
-
 /*******************************************************************
  * @brief Reads the CL Configuration.
  *
@@ -143,63 +96,78 @@ void FillSlotConfig()
 
 uint8_t readMacCfg()
 {
-   uint8_t idx=0, sliceIdx=0;
+   uint8_t idx=0, sliceIdx=0,plmnIdx = 0;
    F1TaiSliceSuppLst *taiSliceSuppLst;
 
-   duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
-
-   /* Cell configuration */
-   duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
-   duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
-
    /* DL carrier configuration */
-   duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
 #ifdef O1_ENABLE
    duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
-   duCfgParam.macCellCfg.phyCellId = cellParams.nRPCI;
-   duCfgParam.macCellCfg.dlCarrCfg.bw = cellParams.bSChannelBwUL;
-   duCfgParam.macCellCfg.dlCarrCfg.freq = cellParams.bSChannelBwDL;
+   duCfgParam.macCellCfg.carrCfg.dlBw = cellParams.bSChannelBwDL;
+   duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(cellParams.arfcnDL);
 #else
    duCfgParam.macCellCfg.cellId = NR_CELL_ID;
-   duCfgParam.macCellCfg.phyCellId = NR_PCI;
-   duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
-   duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
+   duCfgParam.macCellCfg.carrCfg.dlBw = NR_BANDWIDTH;
+   duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(NR_DL_ARFCN);
 #endif
-   
-   duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
-   duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
-   duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
-
+   duCfgParam.macCellCfg.carrCfg.numTxAnt = NUM_TX_ANT;
    /* UL Carrier configuration */
-   duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
 #ifdef O1_ENABLE
-   duCfgParam.macCellCfg.ulCarrCfg.bw = cellParams.bSChannelBwUL;
-   duCfgParam.macCellCfg.ulCarrCfg.freq = cellParams.bSChannelBwDL;
+   duCfgParam.macCellCfg.carrCfg.ulBw = cellParams.bSChannelBwUL;
+   duCfgParam.macCellCfg.carrCfg.ulFreq = convertArfcnToFreqKhz(cellParams.arfcnUL);
 #else   
-   duCfgParam.macCellCfg.ulCarrCfg.bw = NR_BANDWIDTH;
-   duCfgParam.macCellCfg.ulCarrCfg.freq =  NR_UL_ARFCN;
+   duCfgParam.macCellCfg.carrCfg.ulBw = NR_BANDWIDTH;
+   duCfgParam.macCellCfg.carrCfg.ulFreq =  convertArfcnToFreqKhz(NR_UL_ARFCN);
 #endif   
-   duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
-   duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
-
-   duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
+   duCfgParam.macCellCfg.carrCfg.numRxAnt = NUM_RX_ANT;
+
+   /* Cell configuration */
+#ifdef O1_ENABLE
+   duCfgParam.macCellCfg.cellCfg.opState    = cellParams.operationalState;
+   duCfgParam.macCellCfg.cellCfg.adminState = cellParams.administrativeState;
+   duCfgParam.macCellCfg.cellCfg.cellState  = cellParams.cellState;
+   duCfgParam.macCellCfg.cellCfg.phyCellId  = cellParams.nRPCI;
+   duCfgParam.macCellCfg.cellCfg.tac        = cellParams.nRTAC;
+   duCfgParam.macCellCfg.cellCfg.ssbFreq    = convertArfcnToFreqKhz(cellParams.ssbFrequency);
+#else
+   duCfgParam.macCellCfg.cellCfg.opState    = OP_DISABLED; 
+   duCfgParam.macCellCfg.cellCfg.adminState = ADMIN_UNLOCKED;
+   duCfgParam.macCellCfg.cellCfg.cellState  = CELL_INACTIVE;
+   duCfgParam.macCellCfg.cellCfg.phyCellId  = NR_PCI;
+   duCfgParam.macCellCfg.cellCfg.tac        = DU_TAC; 
+   duCfgParam.macCellCfg.cellCfg.ssbFreq    = SSB_FREQUENCY;
+#endif
+   /* Plmn And SNSSAI Configuration */
+   for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
+   {
+      memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\
+            sizeof(Plmn));
+      taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst;
+      duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
+      if(taiSliceSuppLst->snssai)
+      {
+         DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice) * sizeof(Snssai*));
+         if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP)
+         {
+            DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
+            return RFAILED;
+         }
+      }
+      for(sliceIdx=0; sliceIdx < taiSliceSuppLst->numSupportedSlices; sliceIdx++)
+      {
+         if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
+         {
+            DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
+            if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx] == NULLP)
+            {
+               DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
+               return RFAILED;
+            }
+            memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
+         }
+      }
+   }
+   duCfgParam.macCellCfg.cellCfg.numerology = NR_NUMEROLOGY;
+   duCfgParam.macCellCfg.cellCfg.dupType    = DUPLEX_MODE;
 
    /* SSB configuration */
    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
@@ -225,75 +193,55 @@ uint8_t readMacCfg()
    {
       memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
    }
-   duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
-   duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
 
    /* PRACH configuration */
-   duCfgParam.macCellCfg.prachCfg.pres = TRUE;
-   duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
-   duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
+   duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
-   duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
-   duCfgParam.macCellCfg.prachCfg.rootSeqLen    = ROOT_SEQ_LEN;
    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
-   duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
-   if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
-   {
-       DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
-       NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
-        if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
-       {
-           DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed at readMacCfg");
-           return RFAILED;
-       }
-       *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
-    }
+   duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
+   duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
+   duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
 
    duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
-   duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
    duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
-   duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
-   duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
-   duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
    duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
-   duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
-#ifdef NR_TDD   
+   
    /* TDD configuration */
-   duCfgParam.macCellCfg.tddCfg.pres = TRUE;
+#ifdef NR_TDD   
    duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
+   duCfgParam.macCellCfg.tddCfg.nrOfDlSlots = NUM_DL_SLOTS;
+   duCfgParam.macCellCfg.tddCfg.nrOfDlSymbols = NUM_DL_SYMBOLS;
+   duCfgParam.macCellCfg.tddCfg.nrOfUlSlots = NUM_UL_SLOTS;
+   duCfgParam.macCellCfg.tddCfg.nrOfUlSymbols = NUM_UL_SYMBOLS;
 
-   FillSlotConfig();
+   //FillSlotConfig();
 
 #endif
-   /* RSSI Measurement configuration */
-   duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
 
    /* fill SIB1 configuration */
-   duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
-   DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
-   memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
-        duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
-   duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
-   duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
-   duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
-   duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
-  
-   duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
+   duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
+   DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
+         duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex = CORESET_0_INDEX;
+   duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
+
+   duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
    if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
-             PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO != 0))
+            PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO != 0))
    {
-      duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
-      memcpy(duCfgParam.macCellCfg.sib1Cfg.pagingCfg.pagingOcc, 
-              duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
+      duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
+      memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.pagingOcc, 
+            duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
    }
    else
    {
-      duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
+      duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
    }
 
    /* fill Intial DL BWP */
@@ -328,7 +276,7 @@ uint8_t readMacCfg()
       PDSCH_START_SYMBOL;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
       PDSCH_LENGTH_SYMBOL;
+
    idx++;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
@@ -363,39 +311,12 @@ uint8_t readMacCfg()
    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
       PUSCH_LENGTH_SYMBOL;
 
-   duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
+   duCfgParam.macCellCfg.ssbCfg.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;
-   
-   /* Plmn And SNSSAI Configuration */
-   memcpy(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
-   sizeof(Plmn));
-   taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
-   duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
-   if(taiSliceSuppLst->snssai)
-   {
-      DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
-      if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
-      {
-         DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
-         return RFAILED;
-      }
-   }
-   for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
-   {
-      if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
-      {
-         DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
-         if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
-         {
-            DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
-            return RFAILED;
-         }
-         memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
-      }
-   }
+
 
 #ifndef O1_ENABLE
 
@@ -404,8 +325,8 @@ uint8_t readMacCfg()
    rrmPolicy.id[0] = 1;
    rrmPolicy.resourceType = PRB;
    rrmPolicy.rRMMemberNum = 1;
-   memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.plmnInfoList.plmn.mcc, 3*sizeof(uint8_t));
-   memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.plmnInfoList.plmn.mnc, 3*sizeof(uint8_t));
+   memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mcc, 3*sizeof(uint8_t));
+   memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mnc, 3*sizeof(uint8_t));
    rrmPolicy.rRMPolicyMemberList[0].sst = 1;
    rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
    rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
@@ -415,7 +336,7 @@ uint8_t readMacCfg()
    rrmPolicy.rRMPolicyDedicatedRatio = 10;
 
    cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
-  
+
 #endif
 
    return ROK;
index 832ef1d..3876523 100644 (file)
@@ -87,7 +87,8 @@
 #define OFFSET_TO_POINT_A 24                     /* PRB Offset to Point A */
 #define BETA_PSS BETA_PSS_0DB  
 #define SSB_PERIODICITY 20
-#define SSB_SUBCARRIER_OFFSET 0               
+#define SSB_SUBCARRIER_OFFSET 0         
+#define SSB_FREQUENCY  3000000   /*ssbFrequency in kHz*/
 #define SSB_MULT_CARRIER_BAND FALSE
 #define MULT_CELL_CARRIER FALSE
 #define FREQ_LOC_BW  28875             /* DL frequency location and bandwidth. Spec 38.508 Table 4.3.1.0B-1*/
 #define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
 #define RA_CONT_RES_TIMER 64
 #define RA_RSP_WINDOW 10
-#define PRACH_RESTRICTED_SET 0 /* Unrestricted */
-#define ROOT_SEQ_LEN 139
 
 /* MACRCO Ddefine for PDCCH Configuration */
 #define PDCCH_SEARCH_SPACE_ID      1    /* Common search space id */
 /* Macro definitions for F1 procedures */
 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
-#define MAX_PLMN           1        /* Max num of broadcast PLMN ids */
+
 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
 #define MAX_NRCELL_BANDS   2       /* Maximum number of frequency bands */
 #define MAX_NUM_OF_SLICE_ITEMS 1024     /* Maximum number of signalled slice support items */
@@ -1305,7 +1304,6 @@ typedef struct rrmPolicyList
 DuCfgParams duCfgParam;
 
 /*function declarations */
-void FillSlotConfig();
 uint8_t readClCfg();
 uint8_t readCfg();
 uint8_t duReadCfg(); 
index 957229d..4e4372a 100644 (file)
@@ -6717,7 +6717,7 @@ uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
       convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell);
 
    /* DMRS Type A position */
-   spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.dmrsTypeAPos);
+   spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos);
 
    /* SSB subcarrier spacing */
    DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
index fd2902c..8d076f7 100644 (file)
@@ -548,7 +548,7 @@ uint8_t commonInit()
       DU_LOG("\nERROR  -->  DU_APP : System Task creation for DU APP failed");
       return RFAILED;
    }
-   ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
+   //ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
 
    /* system task for EGTP */
    if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
@@ -556,7 +556,7 @@ uint8_t commonInit()
       DU_LOG("\nERROR  -->  DU_APP : System Task creation for EGTP failed");
       return RFAILED;
    }
-   ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0);
+   //ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0);
 
    /* system task for RLC_DL and MAC */
    if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
@@ -566,7 +566,7 @@ uint8_t commonInit()
    }
    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-   ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
+   //ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
 
    /* system task for RLC UL */
    if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
@@ -574,7 +574,7 @@ uint8_t commonInit()
       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC UL failed");
       return RFAILED;
    }
-   ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
+   //ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
 
    /* system task for SCTP receiver thread */
    if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
@@ -582,7 +582,7 @@ uint8_t commonInit()
       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCTP failed");
       return RFAILED;
    }
-   ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0);
+   //ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0);
 
    /* system task for lower-mac receiver thread */
    if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
@@ -590,7 +590,7 @@ uint8_t commonInit()
       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Lower MAC failed");
       return RFAILED;
    }
-   ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
+   //ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
 
 #ifndef INTEL_WLS_MEM
    /* system task for phy stub's slot indication generator thread */