/* UE Cb */
typedef struct macUeCb
{
- uint16_t ueId; /* UE Id from DU APP */
- uint16_t crnti; /* UE CRNTI */
- MacCellCb *cellCb; /* Pointer to cellCb to whihc this UE belongs */
- UeState state; /* Is UE active ? */
- MacRaCbInfo *raCb; /* RA info */
- MacBsrTmrCfg bsrTmrCfg; /* BSR Timer Info */
- UeUlCb ulInfo; /* UE specific UL info */
- UeDlCb dlInfo; /* UE specific DL info */
+ uint16_t ueId; /* UE Id from DU APP */
+ uint16_t crnti; /* UE CRNTI */
+ MacCellCb *cellCb; /* Pointer to cellCb to whihc this UE belongs */
+ UeState state; /* Is UE active ? */
+ MacCfraResource cfraResource; /* CF-RA resource */
+ MacRaCbInfo *raCb; /* RA info */
+ MacBsrTmrCfg bsrTmrCfg; /* BSR Timer Info */
+ UeUlCb ulInfo; /* UE specific UL info */
+ UeDlCb dlInfo; /* UE specific DL info */
DataTransmissionAction transmissionAction;
}MacUeCb;
{
uint16_t cellId;
CellState state;
- uint8_t crntiMap;
+ uint16_t crntiMap;
MacRaCbInfo macRaCb[MAX_NUM_UE];
MacDlSlot dlSlot[MAX_SLOTS];
MacUlSlot ulSlot[MAX_SLOTS];
/* Function declarations */
short int macActvTmr(Ent ent,Inst inst);
void fillRarPdu(RarInfo *rarInfo);
-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);
}
-/*******************************************************************
- *
- * @brief Database required to form MAC PDU
- *
- * @details
- *
- * Function : createMacRaCb
- *
- * Functionality:
- * stores the required params for muxing
- *
- * @params[in] Pointer to cellId,
- * crnti
- * @return void
- *
- * ****************************************************************/
-void createMacRaCb(RachIndInfo *rachIndInfo)
-{
- int8_t ueIdx = -1;
- uint16_t crnti = 0;
- uint16_t cellIdx = 0;
-
- GET_CELL_IDX(rachIndInfo->cellId, cellIdx);
-
- ueIdx = getFreeBitFromUeBitMap(rachIndInfo->cellId);
- if(ueIdx == -1)
- {
- DU_LOG("\nERROR --> MAC : Failed to find free UE Idx in UE bit map of cell Id [%d]", rachIndInfo->cellId);
- return;
- }
-
- /* Calculate CRNTI from UE Index */
- GET_CRNTI(crnti, ueIdx+1);
-
- /* store in rach ind structure */
- rachIndInfo->crnti = crnti;
-
- /* store in raCb */
- macCb.macCell[cellIdx]->macRaCb[ueIdx].cellId = rachIndInfo->cellId;
- macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti = crnti;
-}
-
/*************************************************
* @brief fill RLC DL Data
*
return(*macSchRachIndOpts[pst.selector])(&pst, rachInd);
}
+/*******************************************************************
+ *
+ * @brief Adds an entry in list of RA Cb and fills RACH ind info
+ *
+ * @details
+ *
+ * Function : createMacRaCb
+ *
+ * Functionality:
+ * Adds an entry in list of RA Cb and fills RACH ind info
+ *
+ * @params[in] Pointer to cellCB,
+ * Pointer to RACH Indication information
+ * @return ROK - SUCCESS
+ * RFAILED - FAILURE
+ *
+ * ****************************************************************/
+uint8_t createMacRaCb(MacCellCb *cellCb, RachIndInfo *rachIndInfo)
+{
+ int8_t ueIdx = -1;
+ uint8_t ssbIdx = 0;
+ uint16_t crnti = 0;
+ MacUeCb *ueCb = NULLP;
+
+ /* Search if a UE CB is already present to which the incoming preamble index was dedicated */
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ /* Check if ueCb has a crnti alloted to it. If not, it means this ueIdx
+ * has no UE context stored in it, hence searching for preamble index in
+ * this ueCb is not required */
+ if(cellCb->ueCb[ueIdx].crnti)
+ {
+ for(ssbIdx = 0; ssbIdx < cellCb->ueCb[ueIdx].cfraResource.numSsb; ssbIdx++)
+ {
+ if(cellCb->ueCb[ueIdx].cfraResource.ssbResource[ssbIdx].raPreambleIdx == rachIndInfo->preambleIdx)
+ {
+ ueCb = &cellCb->ueCb[ueIdx];
+ break;
+ }
+ }
+ if(ueCb)
+ break;
+ }
+ }
+
+ if(ueCb)
+ {
+ /* If UE context is already present as in case of handover, fetch CRNTI from
+ * UE CB allocated during UE context creation */
+ crnti = ueCb->crnti;
+ }
+ else
+ {
+ /* If UE context not present, assign CRNTI to this UE */
+ ueIdx = getFreeBitFromUeBitMap(rachIndInfo->cellId);
+ if(ueIdx == -1)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to find free UE Idx in UE bit map of cell Id [%d]", rachIndInfo->cellId);
+ return RFAILED;
+ }
+
+ /* Calculate CRNTI from UE Index */
+ GET_CRNTI(crnti, ueIdx+1);
+
+ /* Store in raCb */
+ cellCb->macRaCb[ueIdx].cellId = rachIndInfo->cellId;
+ cellCb->macRaCb[ueIdx].crnti = crnti;
+ }
+
+ /* Store in Rach Indication message to be sent to SCH */
+ rachIndInfo->crnti = crnti;
+ return ROK;
+}
+
/*******************************************************************
*
* @brief Processes RACH indication from PHY
* ****************************************************************/
uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
{
- uint8_t pduIdx;
- uint8_t preambleIdx;
- RachIndInfo *rachIndInfo;
+ uint8_t ret = ROK;
+ uint8_t pduIdx = 0;
+ uint8_t preambleIdx = 0;
+ uint16_t cellIdx = 0;
+ RachIndInfo *rachIndInfo = NULLP;
+ MacCellCb *cellCb = NULLP;
DU_LOG("\nINFO --> MAC : Received RACH indication");
/* Considering one pdu and one preamble */
pduIdx = 0;
preambleIdx = 0;
+ /* Validate cell Id */
+ GET_CELL_IDX(rachInd->cellId, cellIdx);
+ if(macCb.macCell[cellIdx] && (macCb.macCell[cellIdx]->cellId == rachInd->cellId))
+ cellCb = macCb.macCell[cellIdx];
+
+ if(!cellCb)
+ {
+ DU_LOG("\nERROR --> MAC : Invalid Cell ID [%d] received in RACH Indication", rachInd->cellId);
+ return RFAILED;
+ }
+
MAC_ALLOC(rachIndInfo, sizeof(RachIndInfo));
if(!rachIndInfo)
{
rachIndInfo->timingAdv = rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
/* Store the value in macRaCb */
- createMacRaCb(rachIndInfo);
+ if((ret = createMacRaCb(cellCb, rachIndInfo)) == ROK)
+ {
+ /* Send RACH Indication to SCH */
+ ret = sendRachIndMacToSch(rachIndInfo);
+ }
/* Free sharable buffer used to send RACH Indication from lower MAC to MAC */
MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rachInd, sizeof(RachInd));
- /* Send RACH Indication to SCH */
- return(sendRachIndMacToSch(rachIndInfo));
+ return ret;
}
/*******************************************************************
}
}
- /* TODO : Check if ra-preamble index is to be stored in UE CB */
-
/* Fill SSB RACH resource info if SCH has sent a positive response and
* processing of SCH RACH resource response at MAC has been successful so far */
if(rachRsrcRsp->result == MAC_DU_APP_RSP_OK)
rachRsrcRsp->cfraResource.numSsb = schRachRsrcRsp->cfraResource.numSsb;
memcpy(rachRsrcRsp->cfraResource.ssbResource, schRachRsrcRsp->cfraResource.ssbResource, \
rachRsrcRsp->cfraResource.numSsb * sizeof(MacCfraSsbResource));
+
+ /* Copy resources to UE CB in MAC */
+ memcpy(&ueCb->cfraResource, &rachRsrcRsp->cfraResource, sizeof(MacCfraResource));
}
/* Free SCH RACH resource response */
{
uint32_t raRnti;
RachIndInfo *rachInd;
+ bool isCFRA;
+ SchUeCb *ueCb; /* Filled only if isCFRA = true */
SlotTimingInfo winStartTime;
SlotTimingInfo winEndTime;
}SchRaReq;
*
* This function create raCb
*
- * @param[in] tcrnti
+ * @param[in] crnti
* @param[in] shed instance
* @return void
**/
-void createSchRaCb(uint16_t tcrnti, Inst schInst)
+void createSchRaCb(SchRaReq *raReq, Inst schInst)
{
uint8_t ueId = 0;
- GET_UE_ID(tcrnti, ueId);
- schCb[schInst].cells[schInst]->raCb[ueId -1].tcrnti = tcrnti;
- schCb[schInst].cells[schInst]->raCb[ueId -1].msg4recvd = FALSE;
+ if(raReq->isCFRA)
+ {
+ /* If a UE in handover has triggered CFRA, its UE CB context is already present in SCH,
+ * Hence, no need to create raCb */
+ if(raReq->ueCb && (raReq->ueCb->state == SCH_UE_HANDIN_IN_PROGRESS))
+ {
+ schCb[schInst].cells[schInst]->numActvUe++;
+ SET_ONE_BIT(raReq->ueCb->ueId, schCb[schInst].cells[schInst]->actvUeBitMap);
+ raReq->ueCb->state = SCH_UE_STATE_ACTIVE;
+ }
+ }
+ else
+ {
+ /* Create RA CB only for CB-RA to use for msg3 and msg4 processing */
+ GET_UE_ID(raReq->rachInd->crnti, ueId);
+ schCb[schInst].cells[schInst]->raCb[ueId -1].tcrnti = raReq->rachInd->crnti;
+ schCb[schInst].cells[schInst]->raCb[ueId -1].msg4recvd = FALSE;
+ }
}
/**
**/
bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId)
{
- bool k2Found = false;
- uint8_t k0TblIdx = 0, k2TblIdx = 0;
- uint8_t k0Index = 0, k2Index = 0;
- uint8_t k0 = 0, k2 = 0;
+ bool k1Found = false, k2Found = false;
+ uint8_t k0TblIdx = 0, k1TblIdx = 0, k2TblIdx = 0;
+ uint8_t k0Index = 0, k1Index = 0, k2Index = 0;
+ uint8_t k0 = 0, k1 = 0, k2 = 0;
+ uint8_t numK1 = 0;
uint8_t puschMu = 0;
uint8_t msg3Delta = 0, msg3MinSchTime = 0;
#ifdef NR_TDD
uint8_t totalCfgSlot = 0;
#endif
uint16_t dciSlot = 0, rarSlot = 0;
- SlotTimingInfo dciTime, rarTime, msg3Time;
+ SlotTimingInfo dciTime, rarTime, msg3Time, pucchTime;
RarAlloc *dciSlotAlloc = NULLP; /* Stores info for transmission of PDCCH for RAR */
RarAlloc *rarSlotAlloc = NULLP; /* Stores info for transmission of RAR PDSCH */
SchPuschInfo *msg3PuschInfo = NULLP; /* Stores MSG3 PUSCH scheduling information */
#ifdef NR_TDD
totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
#endif
- k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
- msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
- puschMu = cell->cellCfg.numerology;
- msg3Delta = puschDeltaTable[puschMu];
- msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
+ k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+ if(cell->raReq[ueId-1]->isCFRA == false)
+ {
+ msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+ puschMu = cell->cellCfg.numerology;
+ msg3Delta = puschDeltaTable[puschMu];
+ msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
+ }
/* Calculating time frame to send DCI for RAR */
ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
if(cell->schDlSlotInfo[rarSlot]->pdschUe != 0)
continue;
- for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+ /* If Contention-FREE RA is in progress, allocate resources for
+ * PUCCH for next UL message */
+ if(cell->raReq[ueId-1]->isCFRA)
{
- k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
- k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-
- /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- k2 = k2 + msg3Delta;
- if(k2 >= msg3MinSchTime)
- {
- ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
+ numK1 = k0K1InfoTbl->k0k1TimingInfo[dciTime.slot].k0Indexes[k0TblIdx].k1TimingInfo.numK1;
+ for(k1TblIdx = 0; k1TblIdx < numK1; k1TblIdx++)
+ {
+ k1Index = k0K1InfoTbl->k0k1TimingInfo[dciTime.slot].k0Indexes[k0TblIdx].k1TimingInfo.k1Indexes[k1TblIdx];
+ if(cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck)
+ {
+ k1 = cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck->\
+ dlDataToUlAckList[k1Index];
+ }
+ else
+ {
+ k1 = defaultUlAckTbl[k1Index];
+ }
+
+ ADD_DELTA_TO_TIME(rarTime, pucchTime, k1);
#ifdef NR_TDD
- if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ if(schGetSlotSymbFrmt(pucchTime.slot, cell->slotFrmtBitMap) == DL_SLOT)
continue;
#endif
- /* If PUSCH is already scheduled on this slot, another PUSCH
- * pdu cannot be scheduled here */
- if(cell->schUlSlotInfo[msg3Time.slot]->puschUe != 0)
+ if(cell->schUlSlotInfo[pucchTime.slot]->pucchUe != 0)
continue;
-
- k2Found = true;
+ k1Found = true;
break;
}
}
- if(k2Found)
+ else
+ {
+ /* Else if contention-based RA is in progress, allocate resources for MSG3 */
+ for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+ {
+ k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
+ k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
+
+ /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+ k2 = k2 + msg3Delta;
+ if(k2 >= msg3MinSchTime)
+ {
+ ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
+#ifdef NR_TDD
+ if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ continue;
+#endif
+ /* If PUSCH is already scheduled on this slot, another PUSCH
+ * pdu cannot be scheduled here */
+ if(cell->schUlSlotInfo[msg3Time.slot]->puschUe != 0)
+ continue;
+
+ k2Found = true;
+ break;
+ }
+ }
+ }
+ if(k1Found || k2Found)
break;
}
}
return false;
}
- /* If K0-K2 combination not found, no scheduling happens */
- if(!k2Found)
+ /* If K0-K2 and K0-K1 combination not found, no scheduling happens */
+ if(!k1Found && !k2Found)
return false;
/* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
return false;
}
- /* Allocate resources for msg3 */
- msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time);
- if(msg3PuschInfo)
+ /* Fill RAR info */
+ dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueId-1]->raRnti;
+ dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueId-1]->rachInd->crnti;
+ dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueId-1]->rachInd->preambleIdx;
+ dciSlotAlloc->rarInfo.ta = cell->raReq[ueId-1]->rachInd->timingAdv;
+
+ if(cell->raReq[ueId-1]->isCFRA)
+ {
+ /* Allocate resources for PUCCH */
+ schAllocPucchResource(cell, pucchTime, cell->raReq[ueId-1]->rachInd->crnti);
+ }
+ else
{
- /* Fill RAR info */
- dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueId-1]->raRnti;
- dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueId-1]->rachInd->crnti;
- dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueId-1]->rachInd->preambleIdx;
- dciSlotAlloc->rarInfo.ta = cell->raReq[ueId-1]->rachInd->timingAdv;
- dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
- /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
- dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
- dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
- dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
- dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
- /* Spec 38.213, section 8.2 : In a contention based random access
- * procedure, the CSI request field is reserved. */
- dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ /* Allocate resources for msg3 */
+ msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time);
+ if(msg3PuschInfo)
+ {
+ dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
+ /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
+ dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
+ dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
+ dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
+ dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
+ /* Spec 38.213, section 8.2 : In a contention based random access
+ * procedure, the CSI request field is reserved. */
+ dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ }
}
/* Check if both DCI and RAR are sent in the same slot.
cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId;
cell->schDlSlotInfo[rarSlot]->pdschUe = ueId;
- cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
+ if(cell->raReq[ueId-1]->isCFRA)
+ cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
+ else
+ cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
/* Create raCb at SCH */
- createSchRaCb(cell->raReq[ueId-1]->rachInd->crnti, schInst);
+ createSchRaCb(cell->raReq[ueId-1], schInst);
/* Remove RachInd from pending RA request list */
SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
/* calculate the ra-rnti value */
raReq->raRnti = calculateRaRnti(rachInd->symbolIdx, rachInd->slotIdx, rachInd->freqIdx);
raReq->rachInd = rachInd;
+ if((cell->ueCb[ueId-1].crnti == rachInd->crnti) && (cell->ueCb[ueId-1].state == SCH_UE_HANDIN_IN_PROGRESS))
+ {
+ raReq->isCFRA = true;
+ raReq->ueCb = &cell->ueCb[ueId-1];
+ }
+ else
+ raReq->isCFRA = false;
raReq->winStartTime.sfn = rachInd->timingInfo.sfn;
raReq->winStartTime.slot = rachInd->timingInfo.slot;
#include "RRCReconfiguration-v1530-IEs.h"
#include "CNUEPagingIdentity.h"
#include "PagingCell-Item.h"
+#include "UL-DCCH-Message.h"
#include "cu_stub_sctp.h"
#include "cu_stub_egtp.h"
return RFAILED;
}
memcpy(rrcContainer, ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, rrcContLen);
+
+ if(duDb->ueCb[duUeF1apId-1].state == UE_HANDOVER_IN_PROGRESS)
+ return;
+
break;
}
#define SLOT_DELAY 3
#define NUM_DRB_TO_PUMP_DATA 3
#define NUM_UL_PACKETS 1
+
/*UE Ids for RACH IND*/
#define UE_IDX_0 0
#define UE_IDX_1 1
#define UE_IDX_2 2
+/* Default RA Preamble index to be used when Rach Indication is triggered from
+ * PHY stub */
+#define CB_RA_PREAMBLE_IDX 3 /* For contention based RA */
+#define CF_RA_PREAMBLE_IDX 8 /* For contention free RA */
+
bool slotIndicationStarted;
uint16_t sfnValue;
uint16_t slotValue;
uint8_t ueId;
uint16_t crnti;
bool rachIndSent;
+ bool isCFRA;
bool msg3Sent;
bool msg5ShortBsrSent;
bool msg5Sent;
bool dlDedMsg;
bool msgSecurityModeComp;
- bool msgRrcReconfiguration;
- bool msgRegistrationComp;
+ bool msgRrcReconfigComp;
+ bool msgRegistrationComp;
uint8_t rlcSnForSrb1; /* Sequence number of PDU at RLC for AM mode */
uint8_t pdcpSn; /* Sequence number of PDU at PDCP */
}UeCb;
uint16_t l1BuildAndSendStopInd();
int inet_pton(int af, const char *sourc, void *dst);
void *establishConnectionWithPeerL1(void *args);
+uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn, uint8_t raPreambleIdx);
+
/**********************************************************************
End of file
**********************************************************************/
MsgType type = 0;
GET_UE_ID(puschPdu.rnti, ueId);
- if(!phyDb.ueDb.ueCb[ueId-1].msg3Sent)
+ if(phyDb.ueDb.ueCb[ueId-1].isCFRA)
{
+ /* In CF-RA in case of handover, RRC Reconfiguration Complete is sent
+ * by UE once RAR is received from DU */
phyDb.ueDb.ueCb[ueId-1].ueId = ueId;
phyDb.ueDb.ueCb[ueId-1].crnti = puschPdu.rnti;
- phyDb.ueDb.ueCb[ueId-1].msg3Sent = true;
- type = MSG_TYPE_MSG3;
- sleep(2);
- }
- else if(!phyDb.ueDb.ueCb[ueId-1].msg5ShortBsrSent)
- {
- phyDb.ueDb.ueCb[ueId-1].msg5ShortBsrSent = true;
- type = MSG_TYPE_SHORT_BSR;
- }
- else if(!phyDb.ueDb.ueCb[ueId-1].msg5Sent)
- {
- phyDb.ueDb.ueCb[ueId-1].msg5Sent = true;
- type = MSG_TYPE_MSG5;
- }
- else if(!phyDb.ueDb.ueCb[ueId-1].msgRegistrationComp)
- {
- phyDb.ueDb.ueCb[ueId-1].msgRegistrationComp = true;
- type = MSG_TYPE_REGISTRATION_COMPLETE;
- }
- else if(!phyDb.ueDb.ueCb[ueId-1].msgSecurityModeComp)
- {
- phyDb.ueDb.ueCb[ueId-1].msgSecurityModeComp = true;
- type = MSG_TYPE_SECURITY_MODE_COMPLETE;
- }
- else if(!phyDb.ueDb.ueCb[ueId-1].msgRrcReconfiguration)
- {
- phyDb.ueDb.ueCb[ueId-1].msgRrcReconfiguration = true;
+ phyDb.ueDb.ueCb[ueId-1].msgRrcReconfigComp = true;
type = MSG_TYPE_RRC_RECONFIG_COMPLETE;
}
else
- return RFAILED;
+ {
+ if(!phyDb.ueDb.ueCb[ueId-1].msg3Sent)
+ {
+ phyDb.ueDb.ueCb[ueId-1].ueId = ueId;
+ phyDb.ueDb.ueCb[ueId-1].crnti = puschPdu.rnti;
+ phyDb.ueDb.ueCb[ueId-1].msg3Sent = true;
+ type = MSG_TYPE_MSG3;
+ sleep(2);
+ }
+ else if(!phyDb.ueDb.ueCb[ueId-1].msg5ShortBsrSent)
+ {
+ phyDb.ueDb.ueCb[ueId-1].msg5ShortBsrSent = true;
+ type = MSG_TYPE_SHORT_BSR;
+ }
+ else if(!phyDb.ueDb.ueCb[ueId-1].msg5Sent)
+ {
+ phyDb.ueDb.ueCb[ueId-1].msg5Sent = true;
+ type = MSG_TYPE_MSG5;
+ }
+ else if(!phyDb.ueDb.ueCb[ueId-1].msgRegistrationComp)
+ {
+ phyDb.ueDb.ueCb[ueId-1].msgRegistrationComp = true;
+ type = MSG_TYPE_REGISTRATION_COMPLETE;
+ }
+ else if(!phyDb.ueDb.ueCb[ueId-1].msgSecurityModeComp)
+ {
+ phyDb.ueDb.ueCb[ueId-1].msgSecurityModeComp = true;
+ type = MSG_TYPE_SECURITY_MODE_COMPLETE;
+ }
+ else if(!phyDb.ueDb.ueCb[ueId-1].msgRrcReconfigComp)
+ {
+ phyDb.ueDb.ueCb[ueId-1].msgRrcReconfigComp = true;
+ type = MSG_TYPE_RRC_RECONFIG_COMPLETE;
+ }
+ else
+ return RFAILED;
+ }
MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t));
if(!rxDataInd)
* RFAILED - failure
*
* ****************************************************************/
-uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
+uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn, uint8_t raPreambleIdx)
{
#ifdef INTEL_FAPI
uint8_t rachPduIdx = 0;
rachPdu->avgSnr = 0;
rachPdu->numPreamble = 1;
- rachPdu->preambleInfo[preamIdx].preambleIndex = 3;
+ rachPdu->preambleInfo[preamIdx].preambleIndex = raPreambleIdx;
rachPdu->preambleInfo[preamIdx].timingAdvance = 0;
rachPdu->preambleInfo[preamIdx].preamblePwr = 0;
{
if(ulTtiReq->pdus[numPdus-1].pduType == 0)
{
- DU_LOG("\nINFO --> PHY STUB: PRACH PDU");
+ DU_LOG("\nINFO --> PHY STUB: PRACH PDU");
}
if(ulTtiReq->pdus[numPdus-1].pduType == 1)
{
- DU_LOG("\nINFO --> PHY STUB: PUSCH PDU");
- l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
- ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu);
+ DU_LOG("\nINFO --> PHY STUB: PUSCH PDU");
+ l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu);
}
if(ulTtiReq->pdus[numPdus-1].pduType == 2)
{
- DU_LOG("\nINFO --> PHY STUB: PUCCH PDU");
+ DU_LOG("\nINFO --> PHY STUB: PUCCH PDU");
+
fapi_ul_tti_req_t ulTtiSlotInd;
- memset(&ulTtiSlotInd, 0, sizeof(fapi_ul_tti_req_t));
- ulTtiSlotInd.slot = ulTtiReq->slot;
- ulTtiSlotInd.sfn = ulTtiReq->sfn;
+ memset(&ulTtiSlotInd, 0, sizeof(fapi_ul_tti_req_t));
+ ulTtiSlotInd.slot = ulTtiReq->slot;
+ ulTtiSlotInd.sfn = ulTtiReq->sfn;
ADD_DELTA_TO_TIME(ulTtiSlotInd, ulTtiSlotInd, SLOT_DELAY);
- l1BuildAndSendUciInd(ulTtiSlotInd.slot, ulTtiSlotInd.sfn, \
- ulTtiReq->pdus[numPdus-1].pdu.pucch_pdu);
+ l1BuildAndSendUciInd(ulTtiSlotInd.slot, ulTtiSlotInd.sfn, ulTtiReq->pdus[numPdus-1].pdu.pucch_pdu);
}
numPdus--;
}
/* Send RACH Ind to L2 for first UE */
if(phyDb.ueDb.ueCb[UE_IDX_0].rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6)
{
+ phyDb.ueDb.ueCb[UE_IDX_0].isCFRA = false;
phyDb.ueDb.ueCb[UE_IDX_0].rachIndSent = true;
- l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn, CB_RA_PREAMBLE_IDX);
phyDb.ueDb.numActvUe++;
}
#if 0
/* Send RACH Ind to L2 for second UE */
if(phyDb.ueDb.ueCb[UE_IDX_1].rachIndSent == false && ulTtiReq->sfn == 304 && ulTtiReq->slot == 0)
{
+ phyDb.ueDb.ueCb[UE_IDX_0].isCFRA = false;
phyDb.ueDb.ueCb[UE_IDX_1].rachIndSent = true;
- l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn, CB_RA_PREAMBLE_IDX);
phyDb.ueDb.numActvUe++;
}
/* Send RACH Ind to L2 for third UE */
if(phyDb.ueDb.ueCb[UE_IDX_2].rachIndSent == false && ulTtiReq->sfn == 526 && ulTtiReq->slot == 0)
{
+ phyDb.ueDb.ueCb[UE_IDX_0].isCFRA = false;
phyDb.ueDb.ueCb[UE_IDX_2].rachIndSent = true;
- l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn, CB_RA_PREAMBLE_IDX);
phyDb.ueDb.numActvUe++;
}
#endif
}
}
}
+ else if(ch == 'r')
+ {
+ /* Trigger RACH Indication towards DU */
+ if(phyDb.ueDb.ueCb[phyDb.ueDb.numActvUe].rachIndSent == false)
+ {
+ phyDb.ueDb.ueCb[phyDb.ueDb.numActvUe].rachIndSent = true;
+ phyDb.ueDb.ueCb[phyDb.ueDb.numActvUe].isCFRA = true;
+ l1BuildAndSendRachInd(slotValue, sfnValue, CF_RA_PREAMBLE_IDX);
+ phyDb.ueDb.numActvUe++;
+ }
+
+ }
DU_LOG("\n");
continue;
}