Rach Indication
[o-du/l2.git] / src / cm / mac_sch_interface.h
index decd330..5f957dc 100644 (file)
 *******************************************************************************/
 
 /* events */
-#define EVENT_SCH_CELL_CFG 1
-#define EVENT_SCH_CELL_CFG_CFM 2
+#define EVENT_SCH_CELL_CFG      1
+#define EVENT_SCH_CELL_CFG_CFM  2
+#define EVENT_DL_BRDCST_ALLOC   3 
+#define EVENT_UL_SCH_INFO       4 
 
 /* selector */
 #define MAC_SCH_LC_SELECTOR 0
 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
 #define MAX_CODEWORDS  1  /* max should be 2 */
 
+/* Datatype in UL SCH Info */
+#define SCH_DATATYPE_PUSCH 1
+#define SCH_DATATYPE_PUSCH_UCI 2
+#define SCH_DATATYPE_UCI 4
+#define SCH_DATATYPE_SRS 8
+#define SCH_DATATYPE_PRACH 16
+
 /*structures*/
 
 
@@ -56,9 +65,8 @@ typedef struct
    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
    uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
    uint32_t    nSSBMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
-} SsbSchCfg;
+}SchSsbCfg;
 
-/* SIB1 interface structure */
 typedef struct bwpCfg
 {
    uint8_t subcarrierSpacing;
@@ -67,21 +75,6 @@ typedef struct bwpCfg
    uint16_t BWPStart;
 }BwpCfg;
 
-typedef struct coresetCfg
-{
-   uint8_t startSymbolIndex;
-   uint8_t durationSymbols;
-   uint8_t freqDomainResource[6];
-   uint8_t cceRegMappingType;
-   uint8_t regBundleSize;
-   uint8_t interleaverSize;
-   uint8_t coreSetType;
-   uint16_t shiftIndex;
-   uint8_t precoderGranularity;
-   uint8_t cceIndex;
-   uint8_t aggregationLevel;
-} CoresetCfg;
-
 typedef struct prg
 {
    uint16_t pmIdx;
@@ -96,34 +89,6 @@ typedef struct beamformingInfo
    Prg  prg[MAX_NUM_PRG];
 } BeamformingInfo;
 
-typedef struct txPowerPdcchInfo
-{
-   uint8_t powerValue;
-   uint8_t powerControlOffsetSS;
-} TxPowerPdcchInfo;
-
-typedef struct dlDCI
-{
-   uint16_t rnti;
-   uint16_t scramblingId;
-   uint16_t scramblingRnti;
-   uint8_t cceIndex;
-   uint8_t aggregLevel;
-   BeamformingInfo beamPdcchInfo;
-   TxPowerPdcchInfo txPdcchPower;
-} DlDCI;
-
-typedef struct sib1PdcchCfg
-{
-   BwpCfg sib1PdcchBwpCfg;
-   /* coreset-0 configuration */
-   CoresetCfg sib1Coreset0Cfg;
-
-   uint16_t numDlDci;
-   DlDCI    sib1DlDci; /* as of now its only one DCI, later it will be numDlCi */
-} Sib1PdcchCfg;
-/* end of SIB1 PDCCH structures */
-
 /* SIB1 PDSCH structures */
 
 typedef struct codewordinfo
@@ -157,6 +122,7 @@ typedef struct pdschFreqAlloc
 
 typedef struct pdschTimeAlloc
 {
+   uint8_t rowIndex;
    uint8_t startSymbolIndex;
    uint8_t numSymbols;
 } PdschTimeAlloc;
@@ -187,6 +153,53 @@ typedef struct sib1PdschCfg
 } Sib1PdschCfg;
 /* SIB1 PDSCH structures end */
 
+/* SIB1 interface structure */
+
+typedef struct coresetCfg
+{
+   uint8_t coreSet0Size;
+   uint8_t startSymbolIndex;
+   uint8_t durationSymbols;
+   uint8_t freqDomainResource[6];
+   uint8_t cceRegMappingType;
+   uint8_t regBundleSize;
+   uint8_t interleaverSize;
+   uint8_t coreSetType;
+   uint16_t shiftIndex;
+   uint8_t precoderGranularity;
+   uint8_t cceIndex;
+   uint8_t aggregationLevel;
+} CoresetCfg;
+
+typedef struct txPowerPdcchInfo
+{
+   uint8_t powerValue;
+   uint8_t powerControlOffsetSS;
+} TxPowerPdcchInfo;
+
+typedef struct dlDCI
+{
+   uint16_t rnti;
+   uint16_t scramblingId;
+   uint16_t scramblingRnti;
+   uint8_t cceIndex;
+   uint8_t aggregLevel;
+   BeamformingInfo beamPdcchInfo;
+   TxPowerPdcchInfo txPdcchPower;
+   Sib1PdschCfg     *pdschCfg;
+} DlDCI;
+
+typedef struct sib1PdcchCfg
+{
+   BwpCfg sib1PdcchBwpCfg;
+   /* coreset-0 configuration */
+   CoresetCfg sib1Coreset0Cfg;
+
+   uint16_t numDlDci;
+   DlDCI    sib1DlDci; /* as of now its only one DCI, later it will be numDlCi */
+} Sib1PdcchCfg;
+/* end of SIB1 PDCCH structures */
+
 typedef struct
 {
    /* parameters recieved from DU-APP */
@@ -201,16 +214,33 @@ typedef struct
        uint8_t n0;
    Sib1PdcchCfg sib1PdcchCfg;
    Sib1PdschCfg sib1PdschCfg;
-} Sib1SchCfg;
+}SchSib1Cfg;
+
+typedef struct schRachCfg
+{
+   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) */
+   uint16_t     rootSeqIdx;        /* Root sequence index */
+   uint8_t      numRootSeq;        /* Number of root sequences required for FD */
+   uint16_t     k1;                /* Frequency Offset for each FD */
+   uint8_t      ssbPerRach;          /* SSB per RACH occassion */
+   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 */
+}SchRachCfg;
 
 typedef struct schCellCfg
 {
-   U16         cellId;     /* Cell Id */
-   U16         phyCellId;  /* Physical cell id */
-       U8          bandwidth;  /* Supported B/W */
+   uint16_t    cellId;     /* Cell Id */
+   uint16_t    phyCellId;  /* Physical cell id */
+       uint8_t     bandwidth;  /* Supported B/W */
    DuplexMode  dupMode;    /* Duplex type: TDD/FDD */
-       SsbSchCfg   ssbSchCfg;
-       Sib1SchCfg  sib1SchCfg;
+       SchSsbCfg   ssbSchCfg;  /* SSB config */
+       SchSib1Cfg  sib1SchCfg; /* SIB1 config */
+   SchRachCfg  schRachCfg; /* PRACH config */
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
@@ -244,6 +274,14 @@ typedef struct sib1AllocInfo
    Sib1PdschCfg sib1PdschCfg;
 } Sib1AllocInfo;
 
+typedef struct prachSchInfo
+{
+       uint8_t  numPrachOcas;   /* Num Prach Ocassions */
+   uint8_t  prachFormat;    /* PRACH Format */
+   uint8_t  numRa;          /* Freq domain ocassion */
+   uint8_t  prachStartSymb; /* Freq domain ocassion */
+}PrachSchInfo;
+
 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
 typedef struct dlBrdcstAlloc
 {
@@ -264,12 +302,28 @@ typedef struct dlBrdcstAlloc
        Sib1AllocInfo sib1Alloc;
 }DlBrdcstAlloc;
 
-/* function pointers */
+/* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
+typedef struct ulSchInfo
+{
+   uint16_t      cellId;         /* Cell Id */
+       SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
+       uint8_t       dataType;       /* Type of info being scheduled */
+       PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
+}UlSchInfo;
 
-typedef int (*SchMacDlBrdcstAllocFunc)     ARGS((                     
-   Pst            *pst,           /* Post Structure */                         
-   DlBrdcstAlloc  *dlBrdcstAlloc    /* slot ind Info */                      
-));
+typedef struct rachIndInfo
+{
+   uint16_t    cellId;
+   uint16_t    crnti;
+   SlotIndInfo timingInfo;
+   uint8_t     slotIdx;
+   uint8_t     symbolIdx;
+   uint8_t     frequencyIdx;
+   uint8_t     preambleIdx;
+   uint16_t    timingAdv;
+}RachIndInfo;
+
+/* function pointers */
 
 typedef int (*SchCellCfgCfmFunc)    ARGS((
    Pst            *pst,           /* Post Structure */                         
@@ -280,9 +334,21 @@ typedef int (*SchCellCfgFunc)    ARGS((
    Pst            *pst,           /* Post Structure */                         
    SchCellCfg  *schCellCfg     /* Cell Cfg  */
 ));
+
+typedef int (*SchMacDlBrdcstAllocFunc)     ARGS((                     
+   Pst            *pst,           /* Post Structure */                         
+   DlBrdcstAlloc  *dlBrdcstAlloc    /* DL Broadcast Info */                      
+));
+
+typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
+   Pst            *pst,           /* Post Structure */                         
+   UlSchInfo      *ulSchInfo    /* UL Sch  Info */                      
+));
+
 /* function declarations */
 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
 int packSchMacDlBrdcstAlloc(Pst *pst, DlBrdcstAlloc  *dlBrdcstAlloc);
+int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 
@@ -292,6 +358,10 @@ EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
+EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
+typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
+int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
+int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
 
 /**********************************************************************
   End of file