Cu ASN changes for DlRrcMessageTransfer
[o-du/l2.git] / src / cm / mac_sch_interface.h
index 6fc4caf..513fc7e 100644 (file)
 
 #define MAX_NUMBER_OF_CRC_IND_BITS 1
 #define MAX_NUM_LOGICAL_CHANNELS   11
-
+/* can we have a common numslot numscs between mac sch */
+#define MAX_SLOTS 10
+#define MAX_SFN   1024
 #define CCCH_LCID  0
+#define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
+   if ((crntTime.slot + incr) > (MAX_SLOTS - 1))   \
+      toFill.sfn = (crntTime.sfn + 1);      \
+   else                                                  \
+      toFill.sfn = crntTime.sfn;                              \
+   toFill.slot = (crntTime.slot + incr) % MAX_SLOTS; \
+   if (toFill.sfn >= MAX_SFN) \
+   { \
+      toFill.sfn%=MAX_SFN; \
+   } \
 
 /*structures*/
 
@@ -67,6 +79,19 @@ typedef enum
        RSP_NOK
 }schMacRsp;
 
+typedef struct timeDomainAlloc
+{
+   uint16_t startSymb;
+       uint16_t numSymb;
+}TimeDomainAlloc;
+
+typedef struct freqDomainAlloc
+{
+   uint16_t startPrb;
+   uint16_t numPrb;
+}FreqDomainAlloc;
+
+
 typedef struct
 {
    uint32_t    ssbPbchPwr;       /* SSB block power */
@@ -79,10 +104,9 @@ typedef struct
 
 typedef struct bwpCfg
 {
-   uint8_t subcarrierSpacing;
-   uint8_t cyclicPrefix;
-   uint16_t BWPSize;
-   uint16_t BWPStart;
+   uint8_t         subcarrierSpacing;
+   uint8_t         cyclicPrefix;
+   FreqDomainAlloc freqAlloc;  
 }BwpCfg;
 
 typedef struct prg
@@ -123,18 +147,16 @@ typedef struct dmrsInfo
 
 typedef struct pdschFreqAlloc
 {
-   uint8_t  resourceAlloc;
+   uint8_t  resourceAllocType;
    /* since we are using type-1, hence rbBitmap excluded */
-   uint16_t rbStart;
-   uint16_t rbSize;
+       FreqDomainAlloc freqAlloc;
    uint8_t  vrbPrbMapping;
 } PdschFreqAlloc;
 
 typedef struct pdschTimeAlloc
 {
-   uint8_t rowIndex;
-   uint8_t startSymbolIndex;
-   uint8_t numSymbols;
+   uint8_t         rowIndex;
+       TimeDomainAlloc timeAlloc;
 } PdschTimeAlloc;
 
 typedef struct txPowerPdschInfo
@@ -145,20 +167,19 @@ typedef struct txPowerPdschInfo
 
 typedef struct pdschCfg
 {
-   uint16_t pduBitmap;
-   uint16_t rnti;
-   uint16_t pduIndex;
-   BwpCfg pdschBwpCfg;
-   uint8_t numCodewords;
-   CodewordInfo codeword[MAX_CODEWORDS];
-   uint16_t dataScramblingId;
-   uint8_t  numLayers;
-   uint8_t  transmissionScheme;
-   uint8_t  refPoint;
-   DmrsInfo dmrs;
-   PdschFreqAlloc freqAlloc;
-   PdschTimeAlloc timeAlloc;
-   BeamformingInfo beamPdschInfo;
+   uint16_t         pduBitmap;
+   uint16_t         rnti;
+   uint16_t         pduIndex;
+   uint8_t          numCodewords;
+   CodewordInfo     codeword[MAX_CODEWORDS];
+   uint16_t         dataScramblingId;
+   uint8_t          numLayers;
+   uint8_t          transmissionScheme;
+   uint8_t          refPoint;
+   DmrsInfo         dmrs;
+   PdschFreqAlloc   pdschFreqAlloc;
+   PdschTimeAlloc   pdschTimeAlloc;
+   BeamformingInfo  beamPdschInfo;
    TxPowerPdschInfo txPdschPower;
 } PdschCfg;
 /* SIB1 PDSCH structures end */
@@ -201,7 +222,6 @@ typedef struct dlDCI
 
 typedef struct pdcchCfg
 {
-   BwpCfg pdcchBwpCfg;
    /* coreset-0 configuration */
    CoresetCfg coreset0Cfg;
 
@@ -222,32 +242,33 @@ typedef struct
        
        /* parameters derived in scheduler */
        uint8_t n0;
+   BwpCfg bwp;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 }SchSib1Cfg;
 
 typedef struct schRachCfg
 {
-   uint8_t      prachCfgIdx; /* PRACH config idx */
-   uint8_t      prachSubcSpacing; /* Subcarrier spacing of RACH */
+   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      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 */
-   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 */
+   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 schBwpParams
 {
-   uint16_t firstPrb;
-   uint16_t numPrb;
-       uint8_t  scs;
-       uint8_t  cyclicPrefix;
+   FreqDomainAlloc freqAlloc;
+       uint8_t         scs;
+       uint8_t         cyclicPrefix;
 }SchBwpParams;
 
 typedef struct schCandidatesInfo
@@ -271,7 +292,8 @@ typedef struct schSearchSpaceCfg
 
 typedef struct schPdcchCfgCmn
 {
-   SchSearchSpaceCfg raSearchSpace;
+   SchSearchSpaceCfg commonSearchSpace;
+   uint8_t raSearchSpaceId;
 }SchPdcchCfgCmn;
 
 typedef struct schPdschCfgCmn
@@ -305,16 +327,16 @@ typedef struct schBwpUlCfg
 
 typedef struct schCellCfg
 {
-   uint16_t    cellId;     /* Cell Id */
-   uint16_t    phyCellId;  /* Physical cell id */
-       uint8_t     bandwidth;  /* Supported B/W */
-   DuplexMode  dupMode;    /* Duplex type: TDD/FDD */
-       SchSsbCfg   ssbSchCfg;  /* SSB config */
-       SchSib1Cfg  sib1SchCfg; /* SIB1 config */
-   SchRachCfg  schRachCfg; /* PRACH config */
-       SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
-       SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
-       uint8_t     puschMu;         /* PUSCH MU */
+   uint16_t    cellId;           /* Cell Id */
+   uint16_t    phyCellId;        /* Physical cell id */
+       uint8_t     bandwidth;        /* Supported B/W */
+   DuplexMode  dupMode;          /* Duplex type: TDD/FDD */
+       SchSsbCfg   ssbSchCfg;        /* SSB config */
+       SchSib1Cfg  sib1SchCfg;       /* SIB1 config */
+   SchRachCfg  schRachCfg;       /* PRACH config */
+       SchBwpDlCfg schInitialDlBwp;  /* Initial DL BWP */
+       SchBwpUlCfg schInitialUlBwp;  /* Initial UL BWP */
+       uint8_t     puschMu;          /* PUSCH MU */
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
@@ -323,27 +345,16 @@ typedef struct schCellCfgCfm
    schMacRsp   rsp;   
 }SchCellCfgCfm;
 
-typedef struct timeDomainAlloc
-{
-   uint16_t startSymb;
-       uint16_t numSymb;
-}TimeDomainAlloc;
-
-typedef struct freqDomainAlloc
-{
-   uint16_t startPrb;
-   uint16_t numPrb;
-}FreqDomainAlloc;
-
 typedef struct ssbInfo
 {
-   uint8_t ssbIdx;          /* SSB Index */
+   uint8_t         ssbIdx;          /* SSB Index */
        TimeDomainAlloc tdAlloc; /* Time domain allocation */
        FreqDomainAlloc fdAlloc; /* Freq domain allocation */
 }SsbInfo;
 
 typedef struct sib1AllocInfo
 {
+   BwpCfg bwp;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
 } Sib1AllocInfo;
@@ -376,19 +387,19 @@ typedef struct dlBrdcstAlloc
 
 typedef struct rarInfo
 {
-   uint16_t raRnti;
-       uint8_t  RAPID;
-       uint16_t ta;
-       uint16_t msg3StartRb;
-       uint8_t  msg3NumRb;
-       uint16_t tcrnti;
-       uint8_t  rarPdu[8];
-       uint8_t  rarPduLen;
+   uint16_t        raRnti;
+       uint8_t         RAPID;
+       uint16_t        ta;
+       FreqDomainAlloc msg3FreqAlloc;
+       uint16_t        tcrnti;
+       uint8_t         rarPdu[8];
+       uint8_t         rarPduLen;
 }RarInfo;
 
 typedef struct rarAlloc
 {
    RarInfo rarInfo;
+   BwpCfg  bwp;
    PdcchCfg rarPdcchCfg;
    PdschCfg rarPdschCfg;
 }RarAlloc;
@@ -404,32 +415,42 @@ typedef struct msg4Info
        uint8_t  dciFormatId;
    uint16_t crnti;
    uint8_t  *msg4Pdu;
-   uint8_t  msg4PduLen;
+   uint16_t  msg4PduLen;
 }Msg4Info;
 
 typedef struct msg4Alloc
 {
    Msg4Info msg4Info;
+   BwpCfg bwp;
    PdcchCfg msg4PdcchCfg;
    PdschCfg msg4PdschCfg;
 }Msg4Alloc;
 
-typedef struct dlAlloc
+typedef struct schSlotValue
+{
+       SlotIndInfo currentTime;
+       SlotIndInfo broadcastTime;
+       SlotIndInfo rarTime;
+       SlotIndInfo msg4Time;
+       SlotIndInfo dlMsgTime;
+}SchSlotValue;
+
+typedef struct dlSchedInfo
 {
    uint16_t cellId;  /* Cell Id */
-       SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
+       SchSlotValue schSlotValue;
 
        /* Allocation for broadcast messages */
-   uint8_t isBroadcastPres;
+   bool isBroadcastPres;
        DlBrdcstAlloc brdcstAlloc;
 
        /* Allocation for RAR message */
-       uint8_t isRarPres;
-       RarAlloc rarAlloc;
+       //uint8_t isRarPres;
+       RarAlloc *rarAlloc;
 
    /* Allocation from MSG4 */
    Msg4Alloc *msg4Alloc;
-}DlAlloc;
+}DlSchedInfo;
 
 typedef struct tbInfo
 {
@@ -449,7 +470,7 @@ typedef struct schPuschInfo
 }SchPuschInfo;
 
 
-typedef struct ulSchInfo
+typedef struct ulSchedInfo
 {
    uint16_t      cellId;         /* Cell Id */
        uint16_t      crnti;          /* CRNI */
@@ -457,7 +478,7 @@ typedef struct ulSchInfo
        uint8_t       dataType;       /* Type of info being scheduled */
        PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
        SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
-}UlSchInfo;
+}UlSchedInfo;
 
 typedef struct rachIndInfo
 {
@@ -510,28 +531,28 @@ typedef int (*SchCellCfgFunc)    ARGS((
 
 typedef int (*SchMacDlAllocFunc)     ARGS((                     
    Pst            *pst,       /* Post Structure */                         
-   DlAlloc        *dlAlloc    /* dl allocation Info */                      
+   DlSchedInfo    *dlSchedInfo    /* dl allocation Info */                      
 ));
 
 typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
-   Pst            *pst,           /* Post Structure */                         
-   UlSchInfo      *ulSchInfo    /* UL Sch  Info */                      
+   Pst         *pst,           /* Post Structure */                         
+   UlSchedInfo *ulSchedInfo         /* UL Alloc Sch  Info */                      
 ));
 
 /* function declarations */
 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
-int packSchMacDlAlloc(Pst *pst, DlAlloc  *dlAlloc);
-int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
+int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
+int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
 
-EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
+EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
 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);
+EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);