Merge "Added a new Flag ODU_LWR_MAC_DEBUG in the code"
[o-du/l2.git] / src / cm / mac_sch_interface.h
index dfd971d..0b82447 100644 (file)
  *******************************************************************************/
 
 /* events */
-#define EVENT_SCH_CELL_CFG      1
-#define EVENT_SCH_CELL_CFG_CFM  2
-#define EVENT_DL_ALLOC          3 
-#define EVENT_UL_SCH_INFO       4 
+#define EVENT_SCH_CELL_CFG           1
+#define EVENT_SCH_CELL_CFG_CFM       2
+#define EVENT_DL_ALLOC               
+#define EVENT_UL_SCH_INFO            
 #define EVENT_RACH_IND_TO_SCH        5
 #define EVENT_CRC_IND_TO_SCH         6
 #define EVENT_DL_RLC_BO_INFO_TO_SCH  7
 #define EVENT_UE_CREATE_REQ_TO_SCH   8
 #define EVENT_UE_CREATE_RSP_TO_MAC   9
 #define EVENT_SLOT_IND_TO_SCH        10
+#define EVENT_SHORT_BSR              11
+#define EVENT_UCI_IND_TO_SCH         12
 
 /*macros*/
 #define NO_SSB 0
@@ -53,7 +55,9 @@
 #define SCH_DATATYPE_PRACH 16
 
 #define MAX_NUMBER_OF_CRC_IND_BITS 1
-#define MAX_NUM_LOGICAL_CHANNELS   11
+#define MAX_NUMBER_OF_UCI_IND_BITS 1
+#define MAX_SR_BITS_IN_BYTES       1
+#define MAX_NUM_LOGICAL_CHANNEL_GROUPS 8
 /* can we have a common numslot numscs between mac sch */
 #define MAX_SLOTS 10
 #define MAX_SFN   1024
@@ -68,7 +72,6 @@
 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
 
 #define SD_SIZE   3
-#define CCCH_LCID  0
 
 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
 {                                                          \
@@ -87,7 +90,6 @@
    }                                                       \
 }
 
-/*structures*/
 typedef enum
 {
    UNSPECIFIED_CAUSE,
@@ -315,6 +317,23 @@ typedef enum
    RSP_NOK
 }SchMacRsp;
 
+typedef enum
+{
+   SHORT_BSR,
+   LONG_BSR,
+   SHORT_TRUNCATED_BSR,
+   LONG_TRUNCATED_BSR
+}BsrType;
+
+typedef enum
+{
+   FORMAT0_0,
+   FORMAT0_1,
+   FORMAT1_0,
+   FORMAT1_1
+}FormatType;
+
+/*structures*/
 typedef struct timeDomainAlloc
 {
    uint16_t startSymb;
@@ -427,7 +446,7 @@ typedef struct pdschCfg
 
 typedef struct coresetCfg
 {
-   uint8_t coreSet0Size;
+   uint8_t coreSetSize;
    uint8_t startSymbolIndex;
    uint8_t durationSymbols;
    uint8_t freqDomainResource[6];
@@ -462,7 +481,7 @@ typedef struct dlDCI
 typedef struct pdcchCfg
 {
    /* coreset-0 configuration */
-   CoresetCfg coreset0Cfg;
+   CoresetCfg coresetCfg;
 
    uint16_t numDlDci;
    DlDCI    dci; /* as of now its only one DCI, later it will be numDlCi */
@@ -587,7 +606,7 @@ typedef struct schCellCfg
 
 typedef struct schCellCfgCfm
 {
-   U16         cellId;     /* Cell Id */
+   uint16_t         cellId;     /* Cell Id */
    SchMacRsp   rsp;   
 }SchCellCfgCfm;
 
@@ -627,7 +646,7 @@ typedef struct dlBrdcstAlloc
     * 0 : No tranamission
     * 1 : SIB1 Transmission
     * 2 : SIB1 Repetition */
-   U8 sib1Trans;
+   uint8_t sib1Trans;
    Sib1AllocInfo sib1Alloc;
 }DlBrdcstAlloc;
 
@@ -650,7 +669,7 @@ typedef struct rarAlloc
    PdschCfg rarPdschCfg;
 }RarAlloc;
 
-typedef struct msg4Info
+typedef struct dlMsgInfo
 {
    uint16_t crnti;
    uint8_t  ndi;
@@ -660,27 +679,90 @@ typedef struct msg4Info
    uint8_t  pucchResInd;
    uint8_t  harqFeedbackInd;
    uint8_t  dciFormatId;
-   uint8_t  *msg4Pdu;
-   uint16_t  msg4PduLen;
-}Msg4Info;
+   bool     isMsg4Pdu;
+   uint16_t  dlMsgPduLen;
+   uint8_t  *dlMsgPdu;
+}DlMsgInfo;
 
-typedef struct msg4Alloc
+typedef struct lcSchInfo
 {
-   Msg4Info msg4Info;
-   BwpCfg bwp;
-   PdcchCfg msg4PdcchCfg;
-   PdschCfg msg4PdschCfg;
-}Msg4Alloc;
+   uint8_t   lcId;
+   uint16_t  schBytes; /* Number of scheduled bytes */
+}LcSchInfo;
+
+typedef struct dlMsgAlloc
+{
+   uint16_t   crnti;
+   uint8_t    numLc;
+   LcSchInfo  lcSchInfo[MAX_NUM_LC]; /* Scheduled LC info */
+   BwpCfg     bwp;
+   PdcchCfg   dlMsgPdcchCfg;
+   PdschCfg   dlMsgPdschCfg;
+   DlMsgInfo  dlMsgInfo;
+}DlMsgAlloc;
 
 typedef struct schSlotValue
 {
    SlotIndInfo currentTime;
    SlotIndInfo broadcastTime;
    SlotIndInfo rarTime;
-   SlotIndInfo msg4Time;
    SlotIndInfo dlMsgTime;
+   SlotIndInfo ulDciTime;
 }SchSlotValue;
 
+typedef struct format0_0
+{
+   uint8_t         resourceAllocType;
+   /* since we are using type-1, hence rbBitmap excluded */
+   FreqDomainAlloc freqAlloc;
+   TimeDomainAlloc timeAlloc;
+   uint16_t        rowIndex;
+   uint8_t         mcs;
+   uint8_t         harqProcId;   /* HARQ Process ID */
+   bool            puschHopFlag;
+   bool            freqHopFlag;
+   uint8_t         ndi;    /* NDI */
+   uint8_t         rv;     /* Redundancy Version */
+   uint8_t         tpcCmd;
+   bool            sUlCfgd;
+}Format0_0;
+
+typedef struct format0_1
+{
+/* TBD */
+
+}Format0_1;
+
+typedef struct format1_0
+{
+/* TBD */
+
+}Format1_0;
+
+typedef struct format1_1
+{
+/* TBD */
+}Format1_1;
+
+typedef struct dciInfo
+{
+   uint16_t      cellId;   
+   uint16_t      crnti;          /* CRNI */
+   SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
+   BwpCfg        bwpCfg;         /* BWP Cfg */
+   CoresetCfg    coresetCfg;     /* Coreset1 Cfg */
+   FormatType    formatType;     /* DCI Format */
+   union
+   {
+      Format0_0  format0_0;      /* Format 0_0 */
+      Format0_1  format0_1;      /* Format 0_1 */
+      Format1_0  format1_0;      /* Format 1_0 */
+      Format1_1  format1_1;      /* Format 1_1 */
+   }format;
+   DlDCI    dciInfo;
+}DciInfo;
+
+
 typedef struct dlSchedInfo
 {
    uint16_t cellId;  /* Cell Id */
@@ -695,7 +777,14 @@ typedef struct dlSchedInfo
    RarAlloc *rarAlloc;
 
    /* Allocation from MSG4 */
-   Msg4Alloc *msg4Alloc;
+   //Msg4Alloc *msg4Alloc;
+
+   /* UL grant in response to BSR */
+   DciInfo    *ulGrant;
+
+   /* Allocation from dedicated DL msg */
+   DlMsgAlloc *dlMsgAlloc;
+
 }DlSchedInfo;
 
 typedef struct tbInfo
@@ -708,6 +797,7 @@ typedef struct tbInfo
 
 typedef struct schPuschInfo
 {
+   uint16_t         crnti;
    uint8_t          harqProcId;   /* HARQ Process ID */
    uint8_t          resAllocType; /* Resource allocation type */
    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
@@ -774,9 +864,9 @@ typedef struct dlRlcBOInfo
 {
    uint16_t    cellId;
    uint16_t    crnti;
-   uint16_t    numLc;
-   BOInfo      boInfo[MAX_NUM_LOGICAL_CHANNELS];
-}DlRlcBOInfo;
+   uint8_t     lcId;
+   uint32_t    dataVolume;
+}DlRlcBoInfo;
 
 /* Info of Scheduling Request to Add/Modify */
 typedef struct schSchedReqInfo
@@ -1109,7 +1199,7 @@ typedef struct schUeCfg
    SchSpCellCfg       spCellCfg;
    SchAggrMaxBitRate  *aggrMaxBitRate;
    uint8_t            numLc;
-   SchLcCfg           lcCfgList[MAX_NUM_LOGICAL_CHANNELS];
+   SchLcCfg           lcCfgList[MAX_NUM_LC];
 }SchUeCfg;
 
 typedef struct schUeCfgRsp
@@ -1121,6 +1211,30 @@ typedef struct schUeCfgRsp
    SchFailureCause cause;
 }SchUeCfgRsp;
 
+typedef struct dataVolInfo
+{
+   uint8_t  lcgId;
+   uint32_t dataVol;
+}DataVolInfo;
+
+typedef struct ulBufferStatusRptInd
+{
+   uint16_t    cellId;
+   uint16_t    crnti;
+   BsrType     bsrType;
+   uint8_t     numLcg;
+   DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
+}UlBufferStatusRptInd;
+
+typedef struct srUciIndInfo
+{
+   uint16_t    cellId;
+   uint16_t    crnti;
+   SlotIndInfo slotInd;
+   uint8_t     numSrBits;
+   uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
+}SrUciIndInfo;
+
 /* function pointers */
 
 typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
@@ -1153,7 +1267,7 @@ typedef uint8_t (*MacSchCrcIndFunc) ARGS((
 
 typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
         Pst         *pst,         /* Post structure */
-        DlRlcBOInfo *dlBoInfo));   /* DL BO Info */
+        DlRlcBoInfo *dlBoInfo));   /* DL BO Info */
 
 typedef uint8_t (*MacSchUeCreateReqFunc) ARGS((
         Pst         *pst,           /* Post structure */
@@ -1167,6 +1281,16 @@ typedef uint8_t (*MacSchSlotIndFunc) ARGS((
          Pst         *pst,          /* Post structure */
         SlotIndInfo *slotInd));    /* Slot Info */
 
+typedef uint8_t (*MacSchBsrFunc)       ARGS((
+   Pst                  *pst,
+   UlBufferStatusRptInd *bsrInd
+));
+
+typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( 
+        Pst         *pst,         /* Post structure */
+        SrUciIndInfo  *uciInd));    /* UCI IND Info */
+
+
 /* function declarations */
 uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
 uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
@@ -1181,18 +1305,22 @@ uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
 uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
 uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
 uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
-uint8_t macSchRachInd(Pst *pst, RachIndInfo *rachInd);
+uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd);
 uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
-uint8_t macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
-uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
-uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
+uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
+uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
+uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
 uint8_t packMacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
-uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
+uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
 uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
 uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
-uint8_t macSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
+uint8_t MacSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
 uint8_t packMacSchSlotInd(Pst * pst, SlotIndInfo * slotInd);
 uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
+uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
+uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
+uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
+uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
 
 /**********************************************************************
   End of file