/* events */
#define EVENT_SCH_CELL_CFG 1
#define EVENT_SCH_CELL_CFG_CFM 2
-#define EVENT_DL_ALLOC 3
+#define EVENT_DL_ALLOC 3
#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
#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
#define SCH_DATATYPE_SRS 8
#define SCH_DATATYPE_PRACH 16
+#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*/
uint16_t pduBitmap;
uint16_t rnti;
uint16_t pduIndex;
- BwpCfg pdschBwpCfg;
uint8_t numCodewords;
CodewordInfo codeword[MAX_CODEWORDS];
uint16_t dataScramblingId;
typedef struct pdcchCfg
{
- BwpCfg pdcchBwpCfg;
/* coreset-0 configuration */
CoresetCfg coreset0Cfg;
/* parameters derived in scheduler */
uint8_t n0;
+ BwpCfg bwp;
PdcchCfg sib1PdcchCfg;
PdschCfg sib1PdschCfg;
}SchSib1Cfg;
typedef struct schPdcchCfgCmn
{
- SchSearchSpaceCfg raSearchSpace;
+ SchSearchSpaceCfg commonSearchSpace;
+ uint8_t raSearchSpaceId;
}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 */
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
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
typedef struct sib1AllocInfo
{
+ BwpCfg bwp;
PdcchCfg sib1PdcchCfg;
PdschCfg sib1PdschCfg;
} Sib1AllocInfo;
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
{
RarInfo rarInfo;
+ BwpCfg bwp;
PdcchCfg rarPdcchCfg;
PdschCfg rarPdschCfg;
}RarAlloc;
-typedef struct dlAlloc
+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;
+ BwpCfg bwp;
+ PdcchCfg msg4PdcchCfg;
+ PdschCfg msg4PdschCfg;
+}Msg4Alloc;
+
+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;
-}DlAlloc;
-typedef struct ulSchInfo
+ //uint8_t isRarPres;
+ RarAlloc *rarAlloc;
+
+ /* Allocation from MSG4 */
+ Msg4Alloc *msg4Alloc;
+}DlSchedInfo;
+
+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 ulSchedInfo
{
uint16_t cellId; /* Cell Id */
+ uint16_t crnti; /* CRNI */
SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
uint8_t dataType; /* Type of info being scheduled */
PrachSchInfo prachSchInfo; /* Prach scheduling info */
-}UlSchInfo;
+ SchPuschInfo schPuschInfo; /* Pusch scheduling info */
+}UlSchedInfo;
typedef struct rachIndInfo
{
uint16_t timingAdv;
}RachIndInfo;
+
+typedef struct crcIndInfo
+{
+ uint16_t cellId;
+ uint16_t crnti;
+ SlotIndInfo timingInfo;
+ uint16_t numCrcInd;
+ 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 */
typedef int (*SchCellCfgCfmFunc) 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);
+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