From ee769160fe5360f0d3ea043deaede2902ae13073 Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Thu, 21 May 2020 17:48:12 +0530 Subject: [PATCH] MAC PDU de-mux and warning fixes Change-Id: I021d87a99116a68e716297a194fba5785bd1a3c1 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac_handle_phy.c | 6 +- src/5gnrmac/mac.h | 19 ++++ src/5gnrmac/mac_demux.c | 186 +++++++++++++++++++++++++++++++++++++++ src/5gnrmac/mac_msg_hdl.c | 99 +++++++++++++++++++++ src/5gnrmac/mac_rach.c | 96 +------------------- src/5gnrmac/mac_slot_ind.c | 105 ++++++++++++++++++++++ src/5gnrmac/rg_lim.c | 96 -------------------- src/phy_stub/l1_bdy1.c | 31 ++++++- 8 files changed, 444 insertions(+), 194 deletions(-) create mode 100644 src/5gnrmac/mac_demux.c diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index 0c4027835..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 */ @@ -333,8 +334,9 @@ uint8_t handleRxDataInd(fapi_rx_data_indication_t *fapiRxDataInd) 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; + + MAC_ALLOC(pdu->pduData, pdu->pduLength); + memcpy(pdu->pduData, fapiRxDataInd->pdus[pduIdx].pduData, pdu->pduLength); } fillLwrMacToMacPst(&pst); diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 43d1e102c..6af82e37c 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -53,6 +53,24 @@ #define SI_RNTI 0xFFFF #define P_RNTI 0xFFFE +#define MAC_LCID_CCCH 0 +#define MAC_DEDLC_MIN_LCID 1 +#define MAC_DEDLC_MAX_LCID 32 +#define MAC_LCID_RESERVED_MIN 33 +#define MAC_LCID_RESERVED_MAX 51 +#define MAC_LCID_CCCH_48BIT 52 +#define MAC_LCID_BIT_RATE_QUERY 53 +#define MAC_LCID_MULT_PHR_FOUR_OCT 54 +#define MAC_LCID_CFG_GRANT_CFM 55 +#define MAC_LCID_MULT_PHR_ONE_OCT 56 +#define MAC_LCID_SINGLE_PHR 57 +#define MAC_LCID_CRNTI 58 +#define MAC_LCID_SHORT_TRUNC_BSR 59 +#define MAC_LCID_LONG_TRUNC_BSR 60 +#define MAC_LCID_SHORT_BSR 61 +#define MAC_LCID_LONG_BSR 62 +#define MAC_LCID_PADDING 63 + typedef struct macDlSlot { DlAlloc dlInfo; @@ -81,6 +99,7 @@ typedef struct macCb EXTERN MacCb macCb; void fillMacToSchPst(Pst *pst); void fillRarPdu(RarInfo *rarInfo); +int unpackRxData(SlotIndInfo timingInfo, RxDataIndPdu *rxDataIndPdu); #endif /********************************************************************** diff --git a/src/5gnrmac/mac_demux.c b/src/5gnrmac/mac_demux.c new file mode 100644 index 000000000..e960c8b3a --- /dev/null +++ b/src/5gnrmac/mac_demux.c @@ -0,0 +1,186 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ +#include +#include +#include + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system service interface */ +#include "cm_hash.h" /* common hash list */ +#include "cm_mblk.h" /* common memory link list library */ +#include "cm_llist.h" /* common linked list library */ +#include "cm_err.h" /* common error */ +#include "cm_lte.h" /* common LTE */ +#include "lrg.h" /* Layer manager interface includes*/ +#include "crg.h" /* CRG interface includes*/ +#include "rgu.h" /* RGU interface includes*/ +#include "tfu.h" /* TFU interface includes */ +#include "rg_sch_inf.h" /* SCH interface includes */ +#include "rg_prg.h" /* PRG (MAC-MAC) interface includes*/ +#include "rg_env.h" /* MAC environmental includes*/ +#include "rg.h" /* MAC includes*/ +#include "rg_err.h" /* MAC error includes*/ +#include "du_log.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "rgu.x" /* RGU types */ +#include "tfu.x" /* RGU types */ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "crg.x" /* CRG interface includes */ +#include "rg_sch_inf.x" /* SCH interface typedefs */ +#include "rg_prg.x" /* PRG (MAC-MAC) Interface typedefs */ +#include "du_app_mac_inf.h" +#include "mac.h" +#include "rg.x" /* typedefs for MAC */ + +/******************************************************************* + * + * @brief De-mux of MAC-Sub PDUs from Rx Data Ind Pdu + * + * @detail + * + * Function : unpackRxData + * + * Functionality: + * De-mux of MAC-Sub PDUs from Rx Data Ind Pdu + * + * @params[in] Pointer to PDU received + * PDU length + * @return ROK + * RFAILED + * + * ****************************************************************/ +int unpackRxData(SlotIndInfo timingInfo, RxDataIndPdu *rxDataIndPdu) +{ + uint8_t lcId; + uint8_t idx = 0; + uint16_t length; + uint8_t *pdu; + uint16_t pduLen; + uint8_t *rxDataPdu; + + pduLen = rxDataIndPdu->pduLength; + rxDataPdu = rxDataIndPdu->pduData; + + while(pduLen > 0) + { + /* LC id is the 6 LSB in 1st octet */ + lcId = (~((~0) << 6)) & rxDataPdu[idx]; + + switch(lcId) + { + case MAC_LCID_CCCH : + { + pduLen--; + + /* for UL CCCH,fixed length of MAC SDU */ + length = 6; + + /* Allocating sharable memory to send ul ccch msg to du app*/ + MAC_ALLOC_SHRABL_BUF(pdu, length); + if(!pdu) + { + DU_LOG("\nMAC : UL CCCH PDU memory allocation failed"); + return RFAILED; + } + idx++; + memcpy(pdu, &rxDataPdu[idx], length); + pduLen -= length; + idx = idx + length; + + /* TODO: + * Fill and send UL-CCCH Indication to DU APP + */ + break; + } + + case MAC_DEDLC_MIN_LCID ... MAC_DEDLC_MAX_LCID : + break; + + case MAC_LCID_RESERVED_MIN ... MAC_LCID_RESERVED_MAX : + break; + + case MAC_LCID_CCCH_48BIT : + break; + + case MAC_LCID_BIT_RATE_QUERY : + break; + + case MAC_LCID_MULT_PHR_FOUR_OCT : + break; + + case MAC_LCID_CFG_GRANT_CFM : + break; + + case MAC_LCID_MULT_PHR_ONE_OCT: + break; + + case MAC_LCID_SINGLE_PHR : + break; + + case MAC_LCID_CRNTI : + break; + + case MAC_LCID_SHORT_TRUNC_BSR : + break; + + case MAC_LCID_LONG_TRUNC_BSR : + break; + + case MAC_LCID_SHORT_BSR : + break; + + case MAC_LCID_LONG_BSR : + break; + + case MAC_LCID_PADDING : + { + break; + } + + default: + { + DU_LOG("\nMAC : Invalid LC Id %d", lcId); + return RFAILED; + } + } /* End of switch */ + + if(lcId == MAC_LCID_PADDING) + break; + + } /* End of While */ + + return ROK; +} /* End of unpackRxData */ + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index a1e4c20e5..945893073 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -57,10 +57,109 @@ #include "du_app_mac_inf.h" #include "rg.x" #include "lwr_mac_fsm.h" +#include "mac.h" + /* This file contains message handling functionality for MAC */ extern void sendToLowerMac(uint16_t msgType, uint32_t msgLen, void *msg); +/* Function pointer for sending crc ind from MAC to SCH */ +MacSchCrcIndFunc macSchCrcIndOpts[]= +{ + packMacSchCrcInd, + macSchCrcInd, + packMacSchCrcInd +}; + +/******************************************************************* + * + * @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); +} + +/******************************************************************* + * + * @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)); +} + +/******************************************************************* + * + * @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) +{ + uint16_t pduIdx; + + DU_LOG("\nMAC : Received Rx Data indication"); + for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++) + { + unpackRxData(rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]); + } + return ROK; +} + /******************************************************************* * * @brief Processes DL data from RLC diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index 2d5d2c829..246e02ba4 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -28,6 +28,7 @@ #include "cm_lte.h" /* Common LTE Defines */ #include "tfu.h" /* RGU Interface includes */ #include "lrg.h" + #include "gen.x" /* general */ #include "ssi.x" /* system services */ #include "cm5.x" /* system services */ @@ -51,14 +52,6 @@ MacSchRachIndFunc macSchRachIndOpts[]= packMacSchRachInd }; -/* Function pointer for sending crc ind from MAC to SCH */ -MacSchCrcIndFunc macSchCrcIndOpts[]= -{ - packMacSchCrcInd, - macSchCrcInd, - packMacSchCrcInd -}; - /******************************************************************* * * @brief Sends RACH indication to SCH @@ -85,33 +78,6 @@ int sendRachIndMacToSch(RachIndInfo *rachInd) 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); -} - - /******************************************************************* * * @brief Processes RACH indication from PHY @@ -158,41 +124,6 @@ uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd) 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] = {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69}; @@ -208,31 +139,6 @@ int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo) 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 **********************************************************************/ diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index e502fbb43..12cdaa10e 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -26,8 +26,14 @@ #include "cm_hash.h" /* Common Hash List Defines */ #include "cm_mblk.h" /* common memory link list library */ #include "cm_lte.h" /* Common LTE Defines */ +#include "rgu.h" #include "tfu.h" /* RGU Interface includes */ #include "lrg.h" +#include "crg.h" /* layer management defines for LTE-MAC */ +#include "rg_sch_inf.h" /* layer management defines for LTE-MAC */ +#include "rg_env.h" +#include "rg.h" + #include "gen.x" /* general */ #include "ssi.x" /* system services */ #include "cm5.x" /* system services */ @@ -37,11 +43,25 @@ #include "cm_hash.x" /* Common Hash List Definitions */ #include "cm_mblk.x" /* common memory link list library */ #include "cm_lte.x" /* Common LTE Defines */ +#include "rgu.x" #include "tfu.x" /* RGU Interface includes */ #include "lrg.x" +#include "crg.x" /* layer management typedefs for MAC */ +#include "rg_sch_inf.x" /* SCH interface typedefs */ +#include "rg_prg.x" #include "du_app_mac_inf.h" #include "mac.h" #include "du_log.h" +#include "rg.x" +#include "mac_upr_inf_api.h" + +/* function pointers for packing slot ind from mac to sch */ +MacSchSlotIndFunc macSchSlotIndOpts[] = +{ + packMacSchSlotInd, + macSchSlotInd, + packMacSchSlotInd +}; /** * @brief process DL allocation from scheduler @@ -69,6 +89,91 @@ int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc) return ROK; } +/** + * @brief Transmission time interval indication from PHY. + * + * @details + * + * Function : sendSlotIndMacToSch + * + * This API is invoked by MAC to send slot ind to scheduler. + * + * @param[in] SlotIndInfo *slotInd + * @return S16 + * -# ROK + * -# RFAILED + **/ +int sendSlotIndMacToSch(SlotIndInfo *slotInd) +{ + /* fill Pst structure to send to lwr_mac to MAC */ + Pst pst; + + fillMacToSchPst(&pst); + pst.event = EVENT_SLOT_IND_TO_SCH; + + return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd); +} + +/******************************************************************* + * + * @brief Send slot indication to DU APP + * + * @details + * + * Function : sendSlotIndMacToDuApp + * + * Functionality: + * Send slot indication to DU APP + * + * @params[in] Slot indication info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) +{ + Pst pst; + uint16_t ret; + SlotInfo *slotInfo; + + /* Allocate sharable memory */ + MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotInfo)); + if(!slotInfo) + { + DU_LOG("\nMAC : Slot Indication memory allocation failed"); + return RFAILED; + } + + slotInfo->cellId = macCb.macCell->cellId; + slotInfo->sfn = slotInd->sfn; + slotInfo->slot = slotInd->slot; + + /* Fill Pst */ + pst.selector = DU_MAC_LWLC; + pst.srcEnt = ENTRG; + pst.dstEnt = ENTDUAPP; + pst.dstInst = 0; + pst.srcInst = macCb.macInst; + pst.dstProcId = rgCb[pst.srcInst].rgInit.procId; + pst.srcProcId = rgCb[pst.srcInst].rgInit.procId; + pst.region = MAC_MEM_REGION; + pst.pool = MAC_POOL; + pst.event = EVENT_MAC_SLOT_IND; + pst.route = 0; + pst.prior = 0; + pst.intfVer = 0; + + ret = MacDuAppSlotInd(&pst, slotInfo); + if(ret != ROK) + { + DU_LOG("\nMAC: Failed to send slot indication to DU APP"); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, slotInfo, sizeof(SlotInfo)); + } + + return ret; +} /* sendSlotIndMacToDuApp */ + + /** * @brief Transmission time interval indication from PHY. * diff --git a/src/5gnrmac/rg_lim.c b/src/5gnrmac/rg_lim.c index a1a7ff122..be24dac76 100755 --- a/src/5gnrmac/rg_lim.c +++ b/src/5gnrmac/rg_lim.c @@ -84,17 +84,6 @@ PRIVATE S16 rgLIMValidateSap ARGS((Inst inst,SuId suId)); #endif PRIVATE Void rgLIMUtlFreeDatIndEvnt ARGS((TfuDatIndInfo *datInd, Bool error)); - -/* function pointers for packing slot ind from mac to sch */ -//S16 packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd); - -MacSchSlotIndFunc macSchSlotIndOpts[] = -{ - packMacSchSlotInd, - macSchSlotInd, - packMacSchSlotInd -}; - #ifdef RG_UNUSED PRIVATE Void rgLIMUtlFreeDatReqEvnt ARGS((TfuDatReqInfo *datReq, Bool error)); @@ -655,91 +644,6 @@ void fapiMacConfigRsp() MacSendCellCfgCfm(RSP_OK); } -/** - * @brief Transmission time interval indication from PHY. - * - * @details - * - * Function : sendSlotIndMacToSch - * - * This API is invoked by MAC to send slot ind to scheduler. - * - * @param[in] SlotIndInfo *slotInd - * @return S16 - * -# ROK - * -# RFAILED - **/ -int sendSlotIndMacToSch(SlotIndInfo *slotInd) -{ - /* fill Pst structure to send to lwr_mac to MAC */ - Pst pst; - - fillMacToSchPst(&pst); - pst.event = EVENT_SLOT_IND_TO_SCH; - - return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd); -} - - -/******************************************************************* - * - * @brief Send slot indication to DU APP - * - * @details - * - * Function : sendSlotIndMacToDuApp - * - * Functionality: - * Send slot indication to DU APP - * - * @params[in] Slot indication info - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) -{ - Pst pst; - uint16_t ret; - SlotInfo *slotInfo; - - /* Allocate sharable memory */ - MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotInfo)); - if(!slotInfo) - { - DU_LOG("\nMAC : Slot Indication memory allocation failed"); - return RFAILED; - } - - slotInfo->cellId = macCb.macCell->cellId; - slotInfo->sfn = slotInd->sfn; - slotInfo->slot = slotInd->slot; - - /* Fill Pst */ - pst.selector = DU_MAC_LWLC; - pst.srcEnt = ENTRG; - pst.dstEnt = ENTDUAPP; - pst.dstInst = 0; - pst.srcInst = macCb.macInst; - pst.dstProcId = rgCb[pst.srcInst].rgInit.procId; - pst.srcProcId = rgCb[pst.srcInst].rgInit.procId; - pst.region = MAC_MEM_REGION; - pst.pool = MAC_POOL; - pst.event = EVENT_MAC_SLOT_IND; - pst.route = 0; - pst.prior = 0; - pst.intfVer = 0; - - ret = MacDuAppSlotInd(&pst, slotInfo); - if(ret != ROK) - { - DU_LOG("\nMAC: Failed to send slot indication to DU APP"); - MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, slotInfo, sizeof(SlotInfo)); - } - - return ret; -} - /******************************************************************* * * @brief Send stop indication to DU APP diff --git a/src/phy_stub/l1_bdy1.c b/src/phy_stub/l1_bdy1.c index 814bb3939..9bb836224 100644 --- a/src/phy_stub/l1_bdy1.c +++ b/src/phy_stub/l1_bdy1.c @@ -357,6 +357,8 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn) 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) @@ -374,11 +376,35 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn) pduInfo->handle = 0; pduInfo->rnti = 0; pduInfo->harqId = 0; - pduInfo->pduLength = 0; + pduInfo->pduLength = 24; 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)); @@ -386,6 +412,9 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn) /* 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; -- 2.16.6