+/*******************************************************************
+ *
+ * @brief Build And Send Rx Data Ind for Msg5
+ *
+ * @details
+ *
+ * Function : l1BuildAndSendMsg5
+ *
+ * Functionality: Build And Send Rx Data Ind for Msg5
+ *
+ * @params[in] SFN
+ * Slot
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t l1BuildAndSendMsg5(uint16_t sfn, uint16_t slot)
+{
+#ifdef INTEL_FAPI
+ uint8_t idx = 0;
+ fapi_rx_data_indication_t *rxDataInd;
+ fapi_pdu_ind_info_t *pduInfo;
+ uint8_t *pdu;
+ uint16_t byteIdx = 0;
+ uint32_t msgLen = 0;
+
+ MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t));
+ if(!rxDataInd)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for Rx Data Indication for msg5");
+ return RFAILED;
+ }
+ memset(rxDataInd, 0, sizeof(fapi_rx_data_indication_t));
+
+ /* TODO: Fill the required values */
+ msgLen = sizeof(fapi_rx_data_indication_t) - sizeof(fapi_msg_t);
+ rxDataInd->sfn = sfn;
+ rxDataInd->slot = slot;
+ rxDataInd->numPdus = 1;
+
+ pduInfo = &rxDataInd->pdus[idx];
+ pduInfo->handle = 100;
+ pduInfo->rnti = 100;
+ pduInfo->harqId = 1;
+ pduInfo->pdu_length = 25;
+ 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->pdu_length);
+ if(!pduInfo->pduData)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for Rx Data Pdu");
+ return RFAILED;
+ }
+
+ /* Filling PDU */
+ pdu = (uint8_t *)pduInfo->pduData;
+
+ uint8_t msg5PduLen = 33;
+ /* For RRC setup complete
+ MAC subheader format is R/F/LCId/L (2/3 bytes)
+ LCId is 1 for SRB1
+ L is length of PDU i.e 6bytes here
+ From 38.321 section 6.1.1
+ */
+ uint8_t msg5[] = {1, msg5PduLen, 0, 0, 16, 0, 5, 223, 128, 16, 94, \
+ 64, 3, 64, 89, 61, 138, 64, 0, 0, 0, 4, 0, 0, 4, 68, 11, 128, \
+ 184, 56, 0, 0, 0, 0, 0};
+
+ msg5PduLen += 2; /* 2bytes of header */
+ memcpy(pdu, &msg5, msg5PduLen);
+ byteIdx += msg5PduLen; /* 2 bytes of header */
+
+ /* Filling MAC SDU for Padding bytes*/
+ if(byteIdx < pduInfo->pdu_length)
+ {
+ /* For Padding
+ MAC subheader format is R/R/LCId (1byte)
+ LCId is 63 for padding
+ From 38.321 section 6.1.1
+ */
+ pdu[byteIdx++] = 63;
+
+ for(; byteIdx < pduInfo->pdu_length; byteIdx++)
+ pdu[byteIdx] = 0;
+ }
+ msgLen += pduInfo->pdu_length;
+
+ fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen);
+
+ /* Sending Rx data indication to MAC */
+ DU_LOG("\nPHY STUB: Sending Rx data Indication to MAC");
+ procPhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd);
+
+ if(pduInfo->pdu_length)
+ MAC_FREE(pduInfo->pduData, pduInfo->pdu_length);
+ MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t));
+#endif
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles Ul Dci request received from MAC
+ *
+ * @details
+ *
+ * Function : l1HdlUlDciReq
+ *
+ * Functionality:
+ * -Handles Ul Dci request received from MAC
+ *
+ * @params[in] Message length
+ * Ul Dci request message pointer
+ *
+ * @return void
+ *
+ * ****************************************************************/
+
+S16 l1HdlUlDciReq(uint16_t msgLen, void *msg)
+{
+#ifdef INTEL_FAPI
+ fapi_ul_dci_req_t *ulDciReq = NULLP;
+
+ ulDciReq = (fapi_ul_dci_req_t *)msg;
+ uint8_t numPdus = ulDciReq->numPdus;
+
+ while(numPdus)
+ {
+ if(ulDciReq->pdus[numPdus-1].pduType == 0)
+ {
+ DU_LOG("\nPHY STUB: Received UL DCI Request for PDCCH PDU");
+ //l1BuildAndSendMsg5(ulDciReq->sfn, ulDciReq->slot);
+ //msg5Sent = true;
+ }
+ numPdus--;
+ }
+
+ MAC_FREE(ulDciReq, msgLen);
+#endif
+ return ROK;
+}
+