-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:7-u18.04 as ubuntu
+FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:8-u18.04 as ubuntu
ADD . /opt/o-du-l2
WORKDIR /opt/o-du-l2
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:7-u18.04 as ubuntu
+FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:8-u18.04 as ubuntu
ADD . /opt/o-du-l2
WORKDIR /opt/o-du-l2
packRachInd
};
+/* Function pointer for crc indication from lower mac to mac */
+packCrcIndMsg sendCrcIndOpts[] =
+{
+ packCrcInd,
+ fapiMacCrcInd,
+ packCrcInd
+};
+
+/* Function pointer for Rx Data indication from lower mac to mac */
+packRxDataIndMsg sendRxDataIndOpts[] =
+{
+ packRxDataInd,
+ fapiMacRxDataInd,
+ packRxDataInd
+};
+
+
/*******************************************************************
*
* @brief Fills post structure
}/* handleRachInd */
+/*******************************************************************
+ *
+ * @brief Handles CRC indication from PHY and sends to MAC
+ *
+ * @details
+ *
+ * Function : handleCrcInd
+ *
+ * Functionality:
+ * Handles CRC indication from PHY and sends to MAC
+ *
+ * @params[in] fapi_crc_ind_t message pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t handleCrcInd(fapi_crc_ind_t *fapiCrcInd)
+{
+ Pst pst;
+ uint8_t crcInfoIdx;
+ uint8_t crcStatusIdx;
+ CrcInfo *crcIndInfo;
+ CrcInd crcInd;
+
+ crcInd.timingInfo.sfn = fapiCrcInd->sfn;
+ crcInd.timingInfo.slot = fapiCrcInd->slot;
+ crcInd.numCrc = fapiCrcInd->numCrcs;
+
+ for(crcInfoIdx = 0; crcInfoIdx < crcInd.numCrc; crcInfoIdx++)
+ {
+ crcIndInfo = &crcInd.crcInfo[crcInfoIdx];
+ crcIndInfo->handle = fapiCrcInd->crc[crcInfoIdx].handle;
+ crcIndInfo->rnti = fapiCrcInd->crc[crcInfoIdx].rnti;
+ crcIndInfo->harqId = fapiCrcInd->crc[crcInfoIdx].harqId;
+ crcIndInfo->tbCrcStatus = fapiCrcInd->crc[crcInfoIdx].tbCrcStatus;
+ crcIndInfo->numCb = fapiCrcInd->crc[crcInfoIdx].numCb;
+ for(crcStatusIdx = 0; crcStatusIdx < crcIndInfo->numCb; crcStatusIdx++)
+ {
+ crcIndInfo->cbCrcStatus[crcStatusIdx] = \
+ fapiCrcInd->crc[crcInfoIdx].cbCrcStatus[crcStatusIdx];
+ }
+ crcIndInfo->ul_cqi = fapiCrcInd->crc[crcInfoIdx].ul_cqi;
+ crcIndInfo->timingAdvance = fapiCrcInd->crc[crcInfoIdx].timingAdvance;
+ crcIndInfo->rssi = fapiCrcInd->crc[crcInfoIdx].rssi;
+ }
+
+ fillLwrMacToMacPst(&pst);
+ pst.event = EVENT_CRC_IND_TO_MAC;
+
+ (*sendCrcIndOpts[pst.selector])(&pst, &crcInd);
+ return ROK;
+
+} /* handleCrcInd */
+
+/*******************************************************************
+ *
+ * @brief Handles Rx Data indication from PHY and sends to MAC
+ *
+ * @details
+ *
+ * Function : handleRxDataInd
+ *
+ * Functionality:
+ * Handles Rx Data indication from PHY and sends to MAC
+ *
+ * @params[in] fapi_rx_data_indication_t message pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t handleRxDataInd(fapi_rx_data_indication_t *fapiRxDataInd)
+{
+ Pst pst;
+ uint8_t pduIdx;
+ RxDataInd rxDataInd;
+ RxDataIndPdu *pdu;
+
+ rxDataInd.timingInfo.sfn = fapiRxDataInd->sfn;
+ rxDataInd.timingInfo.slot = fapiRxDataInd->slot;
+ rxDataInd.numPdus = fapiRxDataInd->numPdus;
+
+ for(pduIdx = 0; pduIdx < rxDataInd.numPdus; pduIdx++)
+ {
+ pdu = &rxDataInd.pdus[pduIdx];
+ pdu->handle = fapiRxDataInd->pdus[pduIdx].handle;
+ pdu->rnti = fapiRxDataInd->pdus[pduIdx].rnti;
+ pdu->harqId = fapiRxDataInd->pdus[pduIdx].harqId;
+ pdu->pduLength = fapiRxDataInd->pdus[pduIdx].pduLength;
+ pdu->ul_cqi = fapiRxDataInd->pdus[pduIdx].ul_cqi;
+ pdu->timingAdvance = fapiRxDataInd->pdus[pduIdx].timingAdvance;
+ pdu->rssi = fapiRxDataInd->pdus[pduIdx].rssi;
+ /* TODO : Copy pdu from FAPI msg to MAC structure*/
+ //pdu->pduData;
+ }
+
+ fillLwrMacToMacPst(&pst);
+ pst.event = EVENT_RX_DATA_IND_TO_MAC;
+
+ (*sendRxDataIndOpts[pst.selector])(&pst, &rxDataInd);
+ return ROK;
+}
+
#endif /* FAPI */
void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
}
case FAPI_RX_DATA_INDICATION:
{
+ fapi_rx_data_indication_t *rxDataInd;
+ rxDataInd = (fapi_rx_data_indication_t *)msg;
+ handleRxDataInd(rxDataInd);
break;
}
case FAPI_CRC_INDICATION:
{
+ fapi_crc_ind_t *crcInd;
+ crcInd = (fapi_crc_ind_t *)msg;
+ handleCrcInd(crcInd);
break;
}
case FAPI_UCI_INDICATION:
{
break;
- }
+ }
case FAPI_SRS_INDICATION:
{
break;
#include "lwr_mac_upr_inf.h"
+/*******************************************************************
+ *
+ * @brief Packs and Sends CRC Ind to MAC
+ *
+ * @details
+ *
+ * Function : packCrcInd
+ *
+ * Functionality:
+ * Packs and Sends CRC Ind to MAC
+ *
+ * @params[in] Post structure pointer
+ * CRC indication
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t packCrcInd(Pst *pst, CrcInd *crcInd)
+{
+ if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
+ {
+ return ROK;
+ }
+ else
+ {
+ return RFAILED;
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Packs and Sends Rx Data Ind to MAC
+ *
+ * @details
+ *
+ * Function : packRxDataInd
+ *
+ * Functionality:
+ * Packs and Sends Rx data Ind to MAC
+ *
+ * @params[in] Post structure pointer
+ * Rx Data indication
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd)
+{
+ if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
+ {
+ return ROK;
+ }
+ else
+ {
+ return RFAILED;
+ }
+}
+
+
/*******************************************************************
*
* @brief Packs and Sends RACH Ind to MAC
uint16_t packRachInd(Pst *pst, RachInd *rachInd);
uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
+
+typedef uint16_t (*packCrcIndMsg)(Pst *pst, CrcInd *crcInd);
+uint16_t packCrcInd(Pst *pst, CrcInd *crcInd);
+uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd);
+
+
+typedef uint16_t (*packRxDataIndMsg)(Pst *pst, RxDataInd *rxDataInd);
+uint16_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd);
+uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd);
+
#endif
/**********************************************************************
End of file
packMacSchRachInd
};
+/* Function pointer for sending crc ind from MAC to SCH */
+MacSchCrcIndFunc macSchCrcIndOpts[]=
+{
+ packMacSchCrcInd,
+ macSchCrcInd,
+ packMacSchCrcInd
+};
/*******************************************************************
*
return(*macSchRachIndOpts[pst.selector])(&pst, rachInd);
}
+
+/*******************************************************************
+ *
+ * @brief Sends CRC Indication to SCH
+ *
+ * @details
+ *
+ * Function : sendCrcIndMacToSch
+ *
+ * Functionality:
+ * Sends CRC Indication to SCH
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int sendCrcIndMacToSch(CrcIndInfo *crcInd)
+{
+ Pst pst;
+
+ fillMacToSchPst(&pst);
+ pst.event = EVENT_CRC_IND_TO_SCH;
+
+ return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
+}
+
/*******************************************************************
*
return(sendRachIndMacToSch(rachIndInfo));
}
+/*******************************************************************
+ *
+ * @brief Processes CRC Indication from PHY
+ *
+ * @details
+ *
+ * Function : fapiMacCrcInd
+ *
+ * Functionality:
+ * Processes CRC Indication from PHY
+ *
+ * @params[in] Post Structure Pointer
+ * Crc Indication Pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
+{
+ CrcIndInfo crcIndInfo;
+
+ DU_LOG("\nMAC : Received CRC indication");
+ /* Considering one pdu and one preamble */
+
+ crcIndInfo.cellId = macCb.macCell->cellId;;
+ crcIndInfo.crnti = crcInd->crcInfo[0].rnti;
+ crcIndInfo.timingInfo.sfn = crcInd->timingInfo.sfn;
+ crcIndInfo.timingInfo.slot = crcInd->timingInfo.slot;
+ crcIndInfo.numCrcInd = crcInd->crcInfo[0].numCb;
+ crcIndInfo.crcInd[0] = crcInd->crcInfo[0].cbCrcStatus[0];
+
+ return(sendCrcIndMacToSch(&crcIndInfo));
+}
+
/* spec-38.211 Table 6.3.3.1-7 */
uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] =
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Process Rx Data Ind at MAC
+ *
+ * @details
+ *
+ * Function : fapiMacRxDataInd
+ *
+ * Functionality:
+ * Process Rx Data Ind at MAC
+ *
+ * @params[in] Post structure
+ * Rx Data Indication
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
+{
+ DU_LOG("\nMAC : Received Rx Data indication");
+ /* TODO : Demuxing */
+ return ROK;
+}
+
+
/**********************************************************************
End of file
**********************************************************************/
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Processes CRC indication from MAC
+ *
+ * @details
+ *
+ * Function : macSchCrcInd
+ *
+ * Functionality:
+ * Processes CRC indication from MAC
+ *
+ * @params[in] Post structure
+ * Crc Indication
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
+{
+ switch(crcInd->crcInd[0])
+ {
+ case CRC_FAILED:
+ DU_LOG("\nSCH : Received CRC indication. CRC Status [FAILURE]");
+ break;
+ case CRC_PASSED:
+ DU_LOG("\nSCH : Received CRC indication. CRC Status [PASS]");
+ break;
+ default:
+ DU_LOG("\nSCH : Invalid CRC state %d", crcInd->crcInd[0]);
+ return RFAILED;
+ }
+ return ROK;
+}
+
+
/**
* @brief inti cellCb based on cellCfg
*
#define SI_RNTI 0xFFFF
#define P_RNTI 0xFFFE
+#define CRC_FAILED 0
+#define CRC_PASSED 1
+
/* allocate and zero out a static buffer */
#define SCH_ALLOC(_datPtr, _size) \
{ \
RETVALUE(SPstTsk(pst,mBuf));
}
+/*******************************************************************
+ *
+ * @brief Pack and Send Rach Ind from MAC to SCH
+ *
+ * @details
+ *
+ * Function : packMacSchRachInd
+ *
+ * Functionality:
+ * Pack and Send Rach Ind from MAC to SCH
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd)
{
if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
}
return ROK;
}
+
+/*******************************************************************
+ *
+ * @brief Pack and Send Crc Ind from MAC to SCH
+ *
+ * @details
+ *
+ * Function : packMacSchCrcInd
+ *
+ * Functionality:
+ * Pack and Send Crc Ind from MAC to SCH
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
+{
+ if((pst->selector == MAC_SELECTOR_LC) || (pst->selector == MAC_SELECTOR_LWLC))
+ {
+ /* TODO */
+ }
+ else
+ {
+ return RFAILED;
+ }
+ return ROK;
+}
+
/**
* @brief function to pack DL Broadcast allocation message
* from MAC to SCH
#define SCH_DATATYPE_SRS 8
#define SCH_DATATYPE_PRACH 16
+#define MAX_NUMBER_OF_CRC_IND_BITS 1
+
/*structures*/
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;
+
+
/* function pointers */
typedef int (*SchCellCfgCfmFunc) ARGS((
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);
/**********************************************************************
End of file
#define EVTTFUERRIND 25 /*!< TFU Error Indication */
#define EVENT_RACH_IND_TO_MAC 26
#define EVENT_RACH_IND_TO_SCH 27
+#define EVENT_CRC_IND_TO_MAC 28
+#define EVENT_CRC_IND_TO_SCH 29
+#define EVENT_RX_DATA_IND_TO_MAC 30
/** @} */
#define MAX_PREAM_PER_SLOT 1 /* Max number of preamble per slot */
-#define MAC_RACH_PDU_PER_SLOT 1 /* Max number of rach pdu per slot */
+#define MAX_RACH_PDU_PER_SLOT 1 /* Max number of rach pdu per slot */
+#define MAX_CRCS_PER_SLOT 1
+#define MAX_CB_PER_TTI_IN_BYTES 1
+#define MAX_ULSCH_PDUS_PER_TTI 1
/* selector(coupling) values */
#define TFU_SEL_TC 1 /*!< Selector for Tight coupling. */
{
SlotIndInfo timingInfo;
uint8_t numPdu;
- RachPduInfo rachPdu[MAC_RACH_PDU_PER_SLOT];
+ RachPduInfo rachPdu[MAX_RACH_PDU_PER_SLOT];
}RachInd;
+typedef struct crcInfo
+{
+ uint32_t handle;
+ uint16_t rnti;
+ uint8_t harqId;
+ uint8_t tbCrcStatus;
+ uint16_t numCb;
+ uint8_t cbCrcStatus[MAX_CB_PER_TTI_IN_BYTES];
+ uint8_t ul_cqi;
+ uint16_t timingAdvance;
+ uint16_t rssi;
+}CrcInfo;
+
+typedef struct crcInd
+{
+ SlotIndInfo timingInfo;
+ uint16_t numCrc;
+ CrcInfo crcInfo[MAX_CRCS_PER_SLOT];
+}CrcInd;
+
+typedef struct
+{
+ uint32_t handle;
+ uint16_t rnti;
+ uint8_t harqId;
+ uint16_t pduLength;
+ uint8_t ul_cqi;
+ uint16_t timingAdvance;
+ uint16_t rssi;
+ uint8_t *pduData;
+}RxDataIndPdu;
+
+typedef struct
+{
+ SlotIndInfo timingInfo;
+ uint16_t numPdus;
+ RxDataIndPdu pdus[MAX_ULSCH_PDUS_PER_TTI];
+}RxDataInd;
+
+
typedef S16 (*TfuBndReq) ARGS((
Pst* pst,
SuId suId,
}
+/*******************************************************************
+ *
+ * @brief Build and Send CRC Indication
+ *
+ * @details
+ *
+ * Function : l1BuildAndSendCrcInd
+ *
+ * Functionality:
+ * Build and Send CRC Indication
+ *
+ * @params[in] Slot
+ * SFN
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn)
+{
+#ifdef FAPI
+ uint8_t idx = 0;
+ fapi_crc_ind_t *crcInd;
+
+ MAC_ALLOC(crcInd, sizeof(fapi_crc_ind_t));
+ if(!crcInd)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for CRC Indication Message");
+ return RFAILED;
+ }
+
+ /* TODO: Fill the required values. As of now only 1 CRC status PASS is filled */
+ crcInd->sfn = sfn;
+ crcInd->slot = slot;
+ crcInd->numCrcs = 1;
+
+ crcInd->crc[idx].handle = 0;
+ crcInd->crc[idx].rnti = 0;
+ crcInd->crc[idx].harqId = 0;
+ crcInd->crc[idx].tbCrcStatus = 0;
+ crcInd->crc[idx].numCb = 1;
+ crcInd->crc[idx].cbCrcStatus[0] = 0;
+ crcInd->crc[idx].ul_cqi = 0;
+ crcInd->crc[idx].timingAdvance = 0;
+ crcInd->crc[idx].rssi = 0;
+
+ fillMsgHeader(&crcInd->header, FAPI_CRC_INDICATION, \
+ sizeof(fapi_crc_ind_t));
+
+ /* Sending RACH indication to MAC */
+ DU_LOG("\nPHY STUB: Sending CRC Indication to MAC");
+ handlePhyMessages(crcInd->header.message_type_id, sizeof(fapi_crc_ind_t), (void *)crcInd);
+ MAC_FREE(crcInd, sizeof(fapi_crc_ind_t));
+#endif
+ return ROK;
+} /* l1BuildAndSendCrcInd */
+
+
+/*******************************************************************
+ *
+ * @brief Build and send Rx data indication
+ *
+ * @details
+ *
+ * Function : l1BuildAndSendRxDataInd
+ *
+ * Functionality:
+ * Build and send Rx data indication
+ *
+ * @params[in] SFN
+ * Slot
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn)
+{
+#ifdef FAPI
+ uint8_t idx = 0;
+ fapi_rx_data_indication_t *rxDataInd;
+ fapi_pdu_ind_info_t *pduInfo;
+
+ MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t));
+ if(!rxDataInd)
+ {
+ printf("\nPHY_STUB: Memory allocation failed for Rx Data Indication");
+ return RFAILED;
+ }
+
+ /* TODO: Fill the required values */
+ rxDataInd->sfn = sfn;
+ rxDataInd->slot = slot;
+ rxDataInd->numPdus = 1;
+
+ pduInfo = &rxDataInd->pdus[idx];
+ pduInfo->handle = 0;
+ pduInfo->rnti = 0;
+ pduInfo->harqId = 0;
+ pduInfo->pduLength = 0;
+ pduInfo->ul_cqi = 0;
+ pduInfo->timingAdvance = 0;
+ pduInfo->rssi = 0;
+ pduInfo->pduData = NULL;
+
+ 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);
+ MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t));
+#endif
+ return ROK;
+}
+
/*******************************************************************
*