DL Resource allocation for msg4
[o-du/l2.git] / src / cm / mac_sch_interface.h
index 9d43406..927ac16 100644 (file)
 /* events */
 #define EVENT_SCH_CELL_CFG      1
 #define EVENT_SCH_CELL_CFG_CFM  2
-#define EVENT_DL_ALLOC   3 
+#define EVENT_DL_ALLOC          
 #define EVENT_UL_SCH_INFO       4 
+#define EVENT_RACH_IND_TO_SCH        5
+#define EVENT_CRC_IND_TO_SCH         6
+#define EVENT_DL_RLC_BO_INFO_TO_SCH  7
 
 /* selector */
 #define MAC_SCH_LC_SELECTOR 0
@@ -40,6 +43,8 @@
 #define MAX_NUM_PRG     1 /* max value should be later 275 */
 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
 #define MAX_CODEWORDS  1  /* max should be 2 */
+#define SCH_HARQ_PROC_ID 1 /* harq proc id */
+#define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
 
 /* Datatype in UL SCH Info */
 #define SCH_DATATYPE_PUSCH 1
@@ -49,6 +54,9 @@
 #define SCH_DATATYPE_PRACH 16
 
 #define MAX_NUMBER_OF_CRC_IND_BITS 1
+#define MAX_NUM_LOGICAL_CHANNELS   11
+
+#define CCCH_LCID  0
 
 /*structures*/
 
@@ -266,12 +274,35 @@ typedef struct schPdcchCfgCmn
    SchSearchSpaceCfg raSearchSpace;
 }SchPdcchCfgCmn;
 
+typedef struct schPdschCfgCmn
+{
+   uint8_t k0;
+   uint8_t mappingType;
+   uint8_t startSymbol;
+   uint8_t lengthSymbol;
+}SchPdschCfgCmn;
+
+typedef struct schPuschCfgCmn
+{
+   uint8_t k2;
+   uint8_t mappingType;
+   uint8_t startSymbol;
+   uint8_t lengthSymbol;
+}SchPuschCfgCmn;
+
 typedef struct schBwpDlCfg
 {
    SchBwpParams   bwp;
        SchPdcchCfgCmn pdcchCommon;
+       SchPdschCfgCmn pdschCommon;
 }SchBwpDlCfg;
 
+typedef struct schBwpUlCfg
+{
+   SchBwpParams   bwp;
+       SchPuschCfgCmn puschCommon;
+}SchBwpUlCfg;
+
 typedef struct schCellCfg
 {
    uint16_t    cellId;     /* Cell Id */
@@ -281,7 +312,9 @@ typedef struct schCellCfg
        SchSsbCfg   ssbSchCfg;  /* SSB config */
        SchSib1Cfg  sib1SchCfg; /* SIB1 config */
    SchRachCfg  schRachCfg; /* PRACH config */
-       SchBwpDlCfg    schInitialBwp;
+       SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
+       SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
+       uint8_t     puschMu;         /* PUSCH MU */
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
@@ -292,14 +325,14 @@ typedef struct schCellCfgCfm
 
 typedef struct timeDomainAlloc
 {
-   uint16_t ssbStartSymbIdx;
-       uint16_t ssbSymbolDuration;
+   uint16_t startSymb;
+       uint16_t numSymb;
 }TimeDomainAlloc;
 
 typedef struct freqDomainAlloc
 {
-   uint16_t ssbStartPrbIdx;
-   uint16_t ssbPrbDuration;
+   uint16_t startPrb;
+   uint16_t numPrb;
 }FreqDomainAlloc;
 
 typedef struct ssbInfo
@@ -349,8 +382,8 @@ typedef struct rarInfo
        uint16_t msg3StartRb;
        uint8_t  msg3NumRb;
        uint16_t tcrnti;
-       uint8_t rarPdu[8];
-       uint8_t rarPduLen;
+       uint8_t  rarPdu[8];
+       uint8_t  rarPduLen;
 }RarInfo;
 
 typedef struct rarAlloc
@@ -360,6 +393,27 @@ typedef struct rarAlloc
    PdschCfg rarPdschCfg;
 }RarAlloc;
 
+typedef struct msg4Info
+{
+       uint8_t  ndi;
+       uint8_t  harqProcNum;
+       uint8_t  dlAssignIdx;
+       uint8_t  pucchTpc;
+       uint8_t  pucchResInd;
+       uint8_t  harqFeedbackInd;
+       uint8_t  dciFormatId;
+   uint16_t crnti;
+   uint8_t  *msg4Pdu;
+   uint8_t  msg4PduLen;
+}Msg4Info;
+
+typedef struct msg4Alloc
+{
+   Msg4Info msg4Info;
+   PdcchCfg msg4PdcchCfg;
+   PdschCfg msg4PdschCfg;
+}Msg4Alloc;
+
 typedef struct dlAlloc
 {
    uint16_t cellId;  /* Cell Id */
@@ -372,13 +426,36 @@ typedef struct dlAlloc
        /* Allocation for RAR message */
        uint8_t isRarPres;
        RarAlloc rarAlloc;
+
+   /* Allocation from MSG4 */
+   Msg4Alloc *msg4Alloc;
 }DlAlloc;
+
+typedef struct tbInfo
+{
+   uint8_t  mcs;    /* MCS */
+   uint8_t  ndi;    /* NDI */
+   uint8_t  rv;     /* Redundancy Version */
+   uint16_t tbSize; /* TB Size */
+}TbInfo;
+
+typedef struct schPuschInfo
+{
+   uint8_t          harqProcId;   /* HARQ Process ID */
+   uint8_t          resAllocType; /* Resource allocation type */
+   FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
+   TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
+   TbInfo           tbInfo;       /* TB info */
+}SchPuschInfo;
+
+
 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 */
+       SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
 }UlSchInfo;
 
 typedef struct rachIndInfo
@@ -403,6 +480,20 @@ typedef struct crcIndInfo
    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
 }CrcIndInfo;
 
+typedef struct boInfo
+{
+   uint8_t   lcId;
+   uint32_t  dataVolume;
+}BOInfo;
+
+typedef struct dlRlcBOInfo
+{
+   uint16_t    cellId;
+   uint16_t    crnti;
+   uint16_t    numLc;
+   BOInfo      boInfo[MAX_NUM_LOGICAL_CHANNELS];
+}DlRlcBOInfo;
+
 
 /* function pointers */
 
@@ -446,6 +537,10 @@ int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
+typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
+uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
+uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
+
 
 /**********************************************************************
   End of file