PUCCH CHANGES AT SCH AND LOWER MAC
[o-du/l2.git] / src / cm / du_app_mac_inf.h
index 335c182..c9855a2 100644 (file)
 
 #define NUM_SSB                1       /* max value is 64 */
 #define SSB_MASK_SIZE  1       /* SSB mask size is 32bit for sub6 */
-
+#define SIB1_NEW_TX_PERIOD      160
+#define SIB1_REPETITION_PERIOD   20
+#define CORESET_0_INDEX      0
+#define CORESET_1_INDEX      1
+#define CORESET_2_INDEX      2
+#define CORESET_3_INDEX      3
+#define CORESET_4_INDEX      4
+#define SEARCHSPACE_0_INDEX   0
+#define SEARCHSPACE_1_INDEX   1
+#define SEARCHSPACE_2_INDEX   2
+#define SEARCHSPACE_3_INDEX   3
+#define SEARCHSPACE_4_INDEX   4
+#define SS_MONITORING_SLOT_SL1   0 /* all slots */
+#define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
+#define SIB1_MCS  4
+
+#define SRB_ID_0 0
+#define SRB_ID_1 1
+/* Macros for coupling */
+#define DU_MAC_LC  0
+#define DU_MAC_TC  1
+#define DU_MAC_LWLC  2
 
 /* Event IDs */
 #define EVENT_MAC_CELL_CONFIG_REQ    200
 #define EVENT_MAC_CELL_CONFIG_CFM    201
+#define EVENT_MAC_CELL_START_REQ     202
+#define EVENT_MAC_CELL_STOP_REQ      203
+#define EVENT_MAC_SLOT_IND           204
+#define EVENT_MAC_STOP_IND           205
+#define EVENT_MAC_UL_CCCH_IND        206
+#define EVENT_MAC_DL_CCCH_IND        207
 
 typedef enum
 {
@@ -100,6 +127,12 @@ typedef enum
    SSB_PRDCTY_MS_160
 }SSBPeriod;
 
+typedef enum
+{
+   RRC_REJECT,
+   RRC_SETUP
+}DlCcchMsgType;
+
 typedef struct carrierCfg
 {
    Bool  pres;
@@ -112,16 +145,16 @@ typedef struct carrierCfg
 
 typedef struct ssbCfg
 {
-   U32         ssbPbchPwr;       /* SSB block power */
-   BchPduOpt   bchPayloadOption;       /* Options for generation of payload */
-   U8          scsCmn;           /* subcarrier spacing for common */
-   U16         ssbPrbOffset;     /* SSB PRB offset from point A */
+   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 */
-   U8          ssbSubcOffset;    /* Subcarrier Offset */
-   U32         mibPdu;           /* MIB payload */
-   U32         nSSBMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
-   U8          beamId[NUM_SSB];
+   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 */
 }SsbCfg;
@@ -134,18 +167,25 @@ typedef struct fdmInfo
    U8    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
    U8    numUnusedRootSeq;  /* Number of unused root sequence */
    U8    *unsuedRootSeq;     /* Unused root sequence per FD */
-}FdmInfo;
+}PrachFdmInfo;
 
 typedef struct prachCfg
 {
    Bool          pres;
+       uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
-   U8            prachSubcSpacing;    /* Subcarrier spacing of RACH */
+   uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
-   U8            prachFdm;            /* PRACH FDM (1,2,4,8) */
-   FdmInfo       fdm[8];
-   U8            ssbPerRach;          /* SSB per RACH occassion */
-   Bool          prachMultCarrBand;    /* Multiple carriers in Band */
+       uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
+   uint8_t       msg1Fdm;             /* PRACH FDM (1,2,4,8) */
+       uint8_t       rootSeqLen;          /* Root sequence length */
+   PrachFdmInfo  fdm[8];              /* FDM info */
+   uint8_t       ssbPerRach;          /* SSB per RACH occassion */
+   Bool          prachMultCarrBand;   /* Multiple carriers in Band */
+   uint8_t       prachRestrictedSet; /* Support for PRACH restricted set */
+       uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
+       uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
+   uint8_t       raRspWindow;         /* RA Response Window */
 }PrachCfg;
 
 typedef struct tddCfg
@@ -155,71 +195,221 @@ typedef struct tddCfg
    SlotConfig         slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; 
 }TDDCfg;
 
+typedef struct sib1CellCfg
+{
+   uint8_t  *sib1Pdu;
+   uint16_t sib1PduLen;
+   uint16_t sib1NewTxPeriod;
+   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;
+} Sib1CellCfg; 
+
+typedef struct bwpParams
+{
+   uint16_t firstPrb;
+   uint16_t numPrb;
+       uint8_t  scs;
+       uint8_t  cyclicPrefix;
+}BwpParams;
+
+typedef struct candidatesInfo
+{
+   uint8_t aggLevel1;
+   uint8_t aggLevel2;
+   uint8_t aggLevel4;
+   uint8_t aggLevel8;
+   uint8_t aggLevel16;
+}CandidatesInfo;
+
+typedef struct searchSpaceCfg
+{
+   uint8_t searchSpaceId;
+       uint8_t coresetId;
+       uint16_t monitoringSlot;
+       uint16_t duration;
+       uint16_t monitoringSymbol;
+       CandidatesInfo candidate;
+}SearchSpaceCfg;
+
+typedef struct pdcchConfigCommon
+{
+   /* only one search space is configured during SIB1 */
+   SearchSpaceCfg commonSearchSpace;
+   uint8_t raSearchSpaceId;
+}PdcchConfigCommon;
+
+typedef struct pdschConfigCommon
+{
+   uint8_t k0;
+       uint8_t mappingType;
+       uint8_t startSymbol;
+       uint8_t lengthSymbol;
+}PdschConfigCommon;
+
+typedef struct pucchConfigCommon
+{
+   uint8_t pucchResourceCommon;
+       uint8_t pucchGroupHopping;
+}PucchConfigCommon;
+
+typedef struct puschConfigCommon
+{
+   /* PUSCH-TimeDomainResourceAllocation info */
+   uint8_t k2;
+       uint8_t mappingType;
+       uint8_t startSymbol;
+       uint8_t lengthSymbol;
+}PuschConfigCommon;
+
+typedef struct bwpDlConfig
+{
+   BwpParams      bwp;
+       PdcchConfigCommon pdcchCommon;
+       PdschConfigCommon pdschCommon;
+}BwpDlConfig;
+
+typedef struct bwpUlConfig
+{
+   BwpParams      bwp;
+       // rach config common sent in PrachCfg
+       PucchConfigCommon pucchCommon;
+       PuschConfigCommon puschCommon;
+}BwpUlConfig;
+
 typedef struct macCellCfg
 {
-   U16            transId;
-   U16            cellId;     /* Cell Id */
-   U8             numTlv;     /* Number of configuration TLVs */
-   U8             carrierId;  /* Carrired Index */
-   U16            phyCellId;  /* Physical cell id */
-   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 */
-   TDDCfg         tddCfg;     /* TDD periodicity and slot configuration */
-   RSSIMeasUnit   rssiUnit;   /* RSSI measurement unit */
+       U16            transId;          /* Trans Id */
+       U16            cellId;           /* Cell Id */
+       U8             numTlv;           /* Number of configuration TLVs */
+       U8             carrierId;        /* Carrired Index */
+       U16            phyCellId;        /* Physical cell id */
+       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 */
+   TDDCfg         tddCfg;           /* TDD periodicity and slot configuration */
+   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 */
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
 {
+       uint8_t        rsp; 
    U16            transId;
 }MacCellCfgCfm;
 
-/* function pointers for packing macCellCfg Request */
-typedef S16 (*packMacCellCfgReq) ARGS((
-   Pst           *pst,
-   MacCellCfg    *macCellCfg
-));
+typedef struct slotInfo
+{
+   uint16_t cellId;
+   uint16_t sfn;
+   uint16_t slot;
+}SlotInfo;
 
-typedef S16 (*packMacCellCfgCfm) ARGS((
-   Pst              *pst,
-   MacCellCfgCfm    *macCellCfgCfm
-));
+typedef struct macCellStartInfo
+{
+   uint16_t cellId;
+}MacCellStartInfo;
 
-typedef S16 (*DuMacCellCfgReq)     ARGS((
-        Pst        *pst,               /* Post Structure */
-        MacCellCfg *macCellCfg         /* Config Structure */
-     ));
+typedef struct macCellStopInfo
+{
+   uint16_t cellId;
+}MacCellStopInfo;
 
-typedef S16 (*DuMacCellCfgCfm)     ARGS((
-        MacCellCfgCfm *macCellCfgCfm         /* Config Structure */
-     ));
+typedef struct ulCcchInd
+{
+   uint16_t cellId;
+   uint16_t crnti;
+   uint8_t  *ulCcchMsg;
+}UlCcchIndInfo;
 
-S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
+typedef struct dlCcchInd
+{
+   uint16_t      cellId;
+   uint16_t      crnti;
+   DlCcchMsgType msgType;
+   uint16_t      dlCcchMsgLen;
+   uint8_t       *dlCcchMsg;
+}DlCcchIndInfo;
+
+
+/* Functions for slot Ind from MAC to DU APP*/
+typedef uint16_t (*DuMacSlotInd) ARGS((
+   Pst       *pst,
+   SlotInfo  *slotInfo ));
+
+/* Functions for stop Ind from MAC to DU APP*/
+typedef uint16_t (*DuMacStopInd) ARGS((
+   Pst       *pst,
+   MacCellStopInfo  *cellId ));
+
+/* Functions for mac cell start req */
+typedef uint16_t (*DuMacCellStartReq) ARGS((
+   Pst               *pst, 
+   MacCellStartInfo  *cellStartInfo ));
+
+/* Functions for mac cell stop request */
+typedef uint16_t (*DuMacCellStopReq) ARGS((
+   Pst               *pst,
+   MacCellStopInfo  *cellStopInfo ));
+/* Function pointers for packing macCellCfg Request and Confirm */
+typedef int (*packMacCellCfgReq) ARGS((
+   Pst           *pst,
+   MacCellCfg    *macCellCfg ));
 
-EXTERN S16 MacHdlCellCfgReq
-(
- Pst           *pst,
- MacCellCfg    *macCellCfg
-);
+typedef int (*packMacCellCfgConfirm) ARGS((
+   Pst              *pst,
+   MacCellCfgCfm    *macCellCfgCfm ));
 
-void cmUnpackLwLcMacCellCfg(
-   DuMacCellCfgReq func,
-   Pst *pst,
-   Buffer *mBuf);
+typedef int (*DuMacCellCfgReq) ARGS((
+   Pst        *pst,        
+   MacCellCfg *macCellCfg));
 
-S16 unpackMacCellCfgCfm(
-   DuMacCellCfgCfm func,
-   Pst *pst,
-   Buffer *mBuf);
+typedef int (*DuMacCellCfgCfm) ARGS((
+   Pst        *pst,        
+   MacCellCfgCfm *macCellCfgCfm ));
 
-EXTERN S16 duHandleMacCellCfgCfm
-(
- MacCellCfgCfm    *macCellCfgCfm
-);
+/* Functions for UL CCCH Ind from MAC to DU APP*/
+typedef uint16_t (*DuMacUlCcchInd) ARGS((
+   Pst           *pst,
+   UlCcchIndInfo *ulCcchIndInfo ));
 
+/* Functions for DL CCCH Ind from DU APP to MAC*/
+typedef uint16_t (*DuMacDlCcchInd) ARGS((
+   Pst           *pst,
+   DlCcchIndInfo *dlCcchIndInfo ));
+
+extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
+extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
+extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
+extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
+extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
+extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
+extern int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
+extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
+extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
+extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
+extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
+extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
+extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
+extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
+extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
+uint8_t sendStopIndMacToDuApp();
 #endif
 
 /**********************************************************************