return ROK;
} /* l1BuildAndSendCrcInd */
-
+#ifdef FAPI
/*******************************************************************
*
* @brief Build and send Rx data indication
* RFAILED - failure
*
* ****************************************************************/
-uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn)
+uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_t puschPdu)
{
-#ifdef FAPI
uint8_t idx = 0;
fapi_rx_data_indication_t *rxDataInd;
fapi_pdu_ind_info_t *pduInfo;
+ uint8_t *pdu;
+ uint16_t byteIdx = 0;
MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t));
if(!rxDataInd)
rxDataInd->numPdus = 1;
pduInfo = &rxDataInd->pdus[idx];
- pduInfo->handle = 0;
- pduInfo->rnti = 0;
- pduInfo->harqId = 0;
- pduInfo->pduLength = 0;
+ pduInfo->handle = puschPdu.handle;
+ pduInfo->rnti = puschPdu.rnti;
+ pduInfo->harqId = puschPdu.puschData.harqProcessId;
+ pduInfo->pduLength = puschPdu.puschData.tbSize;
pduInfo->ul_cqi = 0;
pduInfo->timingAdvance = 0;
pduInfo->rssi = 0;
+
+ /* Filling pdu with random values for testing */
pduInfo->pduData = NULL;
+ MAC_ALLOC(pduInfo->pduData, pduInfo->pduLength);
+ if(!pduInfo->pduData)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for Rx Data Pdu");
+ return RFAILED;
+ }
+
+ /* Harcoded Initial RRC setup Request */
+ pdu = (uint8_t *)pduInfo->pduData;
+ pdu[byteIdx++] = 0;
+ pdu[byteIdx++] = 181;
+ pdu[byteIdx++] = 99;
+ pdu[byteIdx++] = 20;
+ pdu[byteIdx++] = 170;
+ pdu[byteIdx++] = 132;
+ pdu[byteIdx++] = 96;
+
+ /* Harcoding the pad bytes */
+ pdu[byteIdx++] = 63;
+
+ for(; byteIdx < pduInfo->pduLength; byteIdx++)
+ pdu[byteIdx] = 0;
fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, \
sizeof(fapi_rx_data_indication_t));
/* Sending Rx data indication to MAC */
DU_LOG("\nPHY STUB: Sending Rx data Indication to MAC");
handlePhyMessages(rxDataInd->header.message_type_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd);
+
+ if(pduInfo->pduLength)
+ MAC_FREE(pduInfo->pduData, pduInfo->pduLength);
MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t));
-#endif
return ROK;
}
-
+#endif
/*******************************************************************
*
{
if(ulTtiReq->pdus[numPdus-1].pduType == 0)
DU_LOG("\nPHY STUB: PRACH PDU");
+ if(ulTtiReq->pdus[numPdus-1].pduType == 1)
+ {
+ DU_LOG("\nPHY STUB: PUSCH PDU");
+ l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
+ ulTtiReq->pdus[numPdus-1].u.pusch_pdu);
+ }
numPdus--;
}