#ifndef _MAC_H_
#define _MAC_H_
-#include <stdio.h>
-
-/* header include files (.h) */
-#include "envopt.h" /* environment options */
-#include "envdep.h" /* environment dependent */
-#include "envind.h" /* environment independent */
-#include "gen.h" /* general */
-#include "ssi.h" /* system services */
-#include "cm_tkns.h" /* Common Token Defines */
-#include "cm_llist.h" /* Common Link List Defines */
-#include "cm_hash.h" /* Common Hash List Defines */
-#include "cm_lte.h" /* Common LTE Defines */
-#include "cm_mblk.h" /* Common LTE Defines */
-#include "rgu.h" /* RGU interface includes*/
-#include "tfu.h" /* TFU Interface defines */
-#include "lrg.h"
-#include "du_app_mac_inf.h"
-#include "mac_sch_interface.h"
-#include "rg.h"
-
-/* header/extern include files (.x) */
-#include "gen.x" /* general */
-#include "ssi.x" /* system services */
-#include "cm_tkns.x" /* Common Token Definitions */
-#include "cm_llist.x" /* Common Link List Definitions */
-#include "cm_lib.x" /* Common Library Definitions */
-#include "cm_hash.x" /* Common Hash List Definitions */
-#include "cm_lte.x" /* Common LTE Defines */
-#include "cm_mblk.x" /* Common LTE Defines */
-#include "rgu.x"
-#include "tfu.x" /* RGU Interface includes */
-#include "lrg.x"
-
-#define MAX_SLOT_SUPPORTED 10 /* numerology 0 15Khz */
-#define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */
-#define SI_RNTI 0xFFFF
-#define P_RNTI 0xFFFE
+/* MAX values */
#define MAX_MAC_CE 6
-#define MAX_UE 1
#define MAX_CRI_SIZE 6
-#define MAX_MAC_DL_PDU 10
+#define MAX_MAC_DL_PDU 16
#define MAX_NUM_HARQ_PROC 16
+#define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */
+#define MAC_TQ_SIZE 10 /* Timing Queue Size */
+#define MAX_NUM_TIMER 1 /* MAX number of MAC timers */
-#define PERIODIC_BSR_TMR_1MS 1
-#define PERIODIC_BSR_TMR_5MS 5
-#define PERIODIC_BSR_TMR_10MS 10
-#define PERIODIC_BSR_TMR_16MS 16
-#define PERIODIC_BSR_TMR_20MS 20
-#define PERIODIC_BSR_TMR_32MS 32
-#define PERIODIC_BSR_TMR_40MS 40
-#define PERIODIC_BSR_TMR_60MS 60
-#define PERIODIC_BSR_TMR_80MS 80
-#define PERIODIC_BSR_TMR_128MS 128
-#define PERIODIC_BSR_TMR_160MS 160
-#define PERIODIC_BSR_TMR_320MS 320
-#define PERIODIC_BSR_TMR_640MS 640
-#define PERIODIC_BSR_TMR_1280MS 1280
-#define PERIODIC_BSR_TMR_2560MS 2560
-
-#define RETX_BSR_TMR_10MS 10
-#define RETX_BSR_TMR_20MS 20
-#define RETX_BSR_TMR_40MS 40
-#define RETX_BSR_TMR_80MS 80
-#define RETX_BSR_TMR_160MS 160
-#define RETX_BSR_TMR_320MS 320
-#define RETX_BSR_TMR_640MS 640
-#define RETX_BSR_TMR_1280MS 1280
-#define RETX_BSR_TMR_2560MS 2560
-#define RETX_BSR_TMR_5120MS 5120
-#define RETX_BSR_TMR_10240MS 10240
-
-#define SR_DELAY_TMR_20MS 20
-#define SR_DELAY_TMR_40MS 40
-#define SR_DELAY_TMR_64MS 64
-#define SR_DELAY_TMR_128MS 128
-#define SR_DELAY_TMR_512MS 512
-#define SR_DELAY_TMR_1024MS 1024
-#define SR_DELAY_TMR_2560MS 2560
+#define DEFAULT_CELLS 1
+#define SI_RNTI 0xFFFF
+#define P_RNTI 0xFFFE
#define MAC_LCID_CCCH 0
-#define MAC_DEDLC_MIN_LCID 1
-#define MAC_DEDLC_MAX_LCID 32
+#define MAC_LCID_MIN 1
+#define MAC_LCID_MAX 32
#define MAC_LCID_RESERVED_MIN 33
#define MAC_LCID_RESERVED_MAX 51
#define MAC_LCID_CCCH_48BIT 52
typedef enum
{
- LC_STATE_INACTIVE,
- LC_STATE_ACTIVE
-}LcState;
+ MAC_LC_STATE_INACTIVE,
+ MAC_LC_STATE_ACTIVE
+}MacLcState;
typedef struct macDlSlot
{
{
uint8_t lcId; /* Logical Channel Id */
uint8_t lcGrpId; /* Logical Channel group */
- LcState lcActive; /* Is LC active ? */
+ MacLcState lcActive; /* Is LC active ? */
}UlLcCb;
/* Downlink dedicated logical channel info */
typedef struct dlLcCb
{
uint8_t lcId; /* Logical channel Id */
- LcState lcState; /* Is LC active ? */
+ MacLcState lcState; /* Is LC active ? */
}DlLcCb;
/* BSR Information */
{
uint8_t maxReTx; /* MAX HARQ retransmission */
uint8_t numUlLc; /* Number of uplink logical channels */
- UlLcCb lcCb[MAX_NUM_LOGICAL_CHANNELS]; /* Uplink dedicated logocal channels */
+ UlLcCb lcCb[MAX_NUM_LC]; /* Uplink dedicated logocal channels */
}UeUlCb;
/* UE specific DL Info */
{
DlHarqEnt dlHarqEnt; /* DL HARQ entity */
uint8_t numDlLc; /* Number of downlink logical channels */
- DlLcCb lcCb[MAX_NUM_LOGICAL_CHANNELS]; /* Downlink dedicated logical channels */
+ DlLcCb lcCb[MAX_NUM_LC]; /* Downlink dedicated logical channels */
}UeDlCb;
/* UE Cb */
struct macCellCb
{
uint16_t cellId;
- MacRaCbInfo macRaCb[MAX_UE];
- MacDlSlot dlSlot[MAX_SLOT_SUPPORTED];
- MacUlSlot ulSlot[MAX_SLOT_SUPPORTED];
+ uint8_t crntiMap;
+ MacRaCbInfo macRaCb[MAX_NUM_UE];
+ MacDlSlot dlSlot[MAX_SLOTS];
+ MacUlSlot ulSlot[MAX_SLOTS];
uint16_t numActvUe;
- MacUeCb ueCb[MAX_UE];
+ MacUeCfg *ueCfgTmpData[MAX_NUM_UE];
+ MacUeCb ueCb[MAX_NUM_UE];
+ MacCellCfg macCellCfg;
+ SlotIndInfo currTime;
};
typedef struct macCb
{
Inst macInst;
ProcId procId;
- MacCellCb *macCell;
+ uint8_t tmrRes; /*!< Timer resolution */
+ CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */
+ CmTqType tmrTq[MAC_TQ_SIZE]; /*!< Timer Task Queue */
+ CmTimer tmrBlk[MAX_NUM_TIMER]; /*!< Timer Block */
+ MacCellCb *macCell[MAX_NUM_CELL];
}MacCb;
/* global variable */
MacCb macCb;
-void fillMacToSchPst(Pst *pst);
+
+/* Function declarations */
+short int macActvTmr(Ent ent,Inst inst);
void fillRarPdu(RarInfo *rarInfo);
-void createMacRaCb(uint16_t cellId, uint16_t crnti);
-void fillMsg4DlData(MacDlData *dlData, uint8_t *msg4Pdu);
+void createMacRaCb(RachIndInfo *rachIndInfo);
+void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu);
void fillMacCe(MacCeInfo *macCeData, uint8_t *msg3Pdu);
void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint16_t tbSize);
-int unpackRxData(RxDataIndPdu *rxDataIndPdu);
-uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti);
-void fillMg4Pdu(Msg4Alloc *msg4Alloc);
+uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxDataIndPdu);
+void fillMg4Pdu(DlMsgAlloc *msg4Alloc);
void buildAndSendMuxPdu(SlotIndInfo currTimingInfo);
-
+uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer);
+uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize);
+uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotIndInfo slotInfo, \
+ uint8_t lcId, uint16_t pduLen, uint8_t *pdu);
+uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotIndInfo slotInfo);
#endif
/**********************************************************************
End of file