X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Flwr_mac_handle_phy.c;h=ecdd4317532e2a1cddc6fd2d9e656001cdd5aeb5;hb=a2484c58e5beeb1ab9e1c86104cf9d9bc56750d1;hp=59301a8b9a5153c50f35f6408927a5ba14160d4c;hpb=b490cd1231cfcc837e8bfccc40c6bb106dceef7c;p=o-du%2Fl2.git diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index 59301a8b9..ecdd43175 100644 --- a/src/5gnrmac/lwr_mac_handle_phy.c +++ b/src/5gnrmac/lwr_mac_handle_phy.c @@ -46,6 +46,7 @@ #include "lwr_mac_fsm.h" #include "lwr_mac_phy.h" #include "lwr_mac_upr_inf.h" +#include "rg.h" #ifdef FAPI /* Function pointer for slot indication from lower mac to mac */ @@ -64,6 +65,29 @@ packRachIndMsg sendRachIndOpts[] = 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 +}; + +/* Function pointer for stop indication from lower mac to mac */ +packStopIndMsg sendStopIndOpts[] = +{ + packStopInd, + fapiMacStopInd, + packStopInd +}; /******************************************************************* * * @brief Fills post structure @@ -137,7 +161,35 @@ U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd) return ret; } +/******************************************************************* + * + * @brief Handles stop indication recived from PHY + * + * @details + * + * Function : handleStopInd + * + * Functionality: + * Handles Stop Indication received from PHY + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t handleStopInd() +{ + uint8_t ret; + Pst pst; + + clGlobalCp.phyState = PHY_STATE_CONFIGURED; + DU_LOG("\nLWR_MAC: PHY has moved to configured state"); + fillLwrMacToMacPst(&pst); + pst.event = EVENT_STOP_IND_TO_MAC; + + ret = (*sendStopIndOpts[pst.selector])(&pst); + return ret; +} /******************************************************************* * * @brief Processes Rach Indication from PHY and sends to MAC @@ -189,6 +241,111 @@ uint8_t handleRachInd(fapi_rach_indication_t *fapiRachInd) }/* 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; + + MAC_ALLOC(pdu->pduData, pdu->pduLength); + memcpy(pdu->pduData, fapiRxDataInd->pdus[pduIdx].pduData, pdu->pduLength); + } + + 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) @@ -210,7 +367,7 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) { if(clGlobalCp.phyState == PHY_STATE_CONFIGURED) { - DU_LOG("\nLOWER MAC: PHY has moved to running state"); + DU_LOG("\nLWR_MAC: PHY has moved to running state"); clGlobalCp.phyState = PHY_STATE_RUNNING; } @@ -225,16 +382,22 @@ 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; @@ -245,6 +408,12 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) rachInd = (fapi_rach_indication_t *)msg; handleRachInd(rachInd); break; + } + case FAPI_STOP_INDICATION: + { + DU_LOG("\nLWR_MAC: Handling Stop Indication"); + handleStopInd(); + break; } } #ifdef INTEL_WLS