X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2F5gnrmac%2Frg_l2m.c;h=bce34a3bb67797b03efe77bc159cbf3364e35b85;hb=def50dc175cebc67238db5f1acd5ff322a2279bd;hp=a393f0819f5393152a2f63062addee07c7388aad;hpb=451e626d5ac7c7e7586bab23358161230449af46;p=o-du%2Fl2.git diff --git a/src/5gnrmac/rg_l2m.c b/src/5gnrmac/rg_l2m.c index a393f0819..bce34a3bb 100755 --- a/src/5gnrmac/rg_l2m.c +++ b/src/5gnrmac/rg_l2m.c @@ -33,15 +33,7 @@ */ /* 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_llist.h" /* common linked list library */ -#include "cm_err.h" /* common error */ -#include "cm_lte.h" /* common LTE */ +#include "common_def.h" #include "lrg.h" #include "crg.h" #include "rgr.h" @@ -53,15 +45,6 @@ #include "rg.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" /* TFU types */ #include "lrg.x" /* layer management typedefs for MAC */ @@ -103,7 +86,7 @@ PRIVATE RgL2MeasCb * rgL2mAllocMeasCb ARGS(( * * @param [in] RgCellCb *cell * @param [in] RgInfL2MeasReq *measInfo - * @param [in] U8 measType + * @param [in] uint8_t measType * @param [out] RgErrInfo *err * @return S16 * -# ROK @@ -111,38 +94,36 @@ PRIVATE RgL2MeasCb * rgL2mAllocMeasCb ARGS(( * */ #ifdef ANSI -PUBLIC S16 rgL2mCreateMeasCb +S16 rgL2mCreateMeasCb ( RgCellCb *cell, RgInfL2MeasReq *measInfo, -U8 measType, +uint8_t measType, RgErrInfo *err ) #else -PUBLIC S16 rgL2mCreateMeasCb(cell, measInfo, measType, err) +S16 rgL2mCreateMeasCb(cell, measInfo, measType, err) RgCellCb *cell; RgInfL2MeasReq *measInfo; -U8 measType; +uint8_t measType; RgErrInfo *err; #endif { // Inst inst = cell->macInst - RG_INST_START; - U32 idx; - RgL2MeasCb *measCb = NULLP; - U8 qciVal = 0; + uint32_t idx; + RgL2MeasCb *measCb = NULLP; + uint8_t qciVal = 0; UNUSED(measType); UNUSED(err); - TRC3(rgL2mCreateMeasCb) - - if ((measCb = rgL2mAllocMeasCb(cell, measInfo, err)) == NULLP) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Allocation of RgL2MeasCb failed"); - RETVALUE(RFAILED); - } + if ((measCb = rgL2mAllocMeasCb(cell, measInfo, err)) == NULLP) + { + RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Allocation of RgL2MeasCb failed"); + return RFAILED; + } //Memcpy is already done in rgL2mAllocMeasCb - /*cmMemcpy((U8 *)&measCb->measReq, (CONSTANT U8 *)measInfo,\ + /*memcpy(&measCb->measReq, (CONSTANT uint8_t *)measInfo,\ sizeof(RgInfL2MeasReq));*/ rgL2mInsertMeasCb(cell, measCb, measInfo); measCb->measReq.timePrd = measInfo->timePrd; @@ -161,7 +142,7 @@ RgErrInfo *err; } cell->qciArray[measInfo->t.prbReq.qci[idx]].mask = TRUE; } - RETVALUE(ROK); + return ROK; } /* rgL2mCreateMeasCb */ @@ -184,14 +165,14 @@ RgErrInfo *err; * -# ROK **/ #ifdef ANSI -PUBLIC S16 rgL2mMeasReq +S16 rgL2mMeasReq ( RgCellCb *cell, RgInfL2MeasReq *measInfo, RgErrInfo *err ) #else -PUBLIC S16 rgL2mMeasReq(cell, measInfo, err) +S16 rgL2mMeasReq(cell, measInfo, err) RgCellCb *cell; RgInfL2MeasReq *measInfo; RgErrInfo *err; @@ -199,15 +180,14 @@ RgErrInfo *err; { S16 ret=RFAILED; - TRC3(rgL2mMeasReq) /* Creaet MeasCb Insert in cell->l2mList and return*/ if ( (ret = rgL2mCreateMeasCb(cell, measInfo, LRG_L2MEAS_AVG_PRB_PER_QCI_UL, err)) != ROK) { /* Clear Downlink MeasCb created Above If exists*/ - RETVALUE(ret); + return (ret); } - RETVALUE(ROK); + return ROK; } /* rgL2mMeasReq */ /** @brief This function sends the measurement confirm * from mac to scheduler @@ -233,13 +213,12 @@ RgInfL2MeasCfm *measCfm; { Pst pst; Inst macInst = cell->macInst - RG_INST_START; - TRC3(rgSndL2MeasCfm) - cmMemset((U8 *)&pst, 0, sizeof(Pst)); + memset(&pst, 0, sizeof(Pst)); rgGetPstToInst(&pst,macInst, cell->schInstMap.schInst); RgMacSchL2Meas(&pst, measCfm); - RETVOID; + return; }/* rgSndL2MeasCfm */ /** @brief This function sends the measurement stop confirm @@ -267,12 +246,11 @@ RgInfL2MeasCfm *measCfm; Pst pst; Inst macInst = cell->macInst - RG_INST_START; - TRC3(rgSndL2MeasStopCfm) - cmMemset((U8 *)&pst, 0, sizeof(Pst)); + memset(&pst, 0, sizeof(Pst)); rgGetPstToInst(&pst,macInst, cell->schInstMap.schInst); RgMacSchL2MeasStop(&pst, measCfm); - RETVOID; + return; }/* rgSndL2MeasStopCfm */ /** @@ -290,13 +268,13 @@ RgInfL2MeasCfm *measCfm; * -# RFAILED **/ #ifdef ANSI -PUBLIC S16 RgSchMacL2MeasReq +S16 RgSchMacL2MeasReq ( Pst *pst, /* post structure */ RgInfL2MeasReq *measInfo /* Meas Req Info */ ) #else -PUBLIC S16 RgSchMacL2MeasReq(pst, measInfo) +S16 RgSchMacL2MeasReq(pst, measInfo) Pst *pst; /* post structure */ RgInfL2MeasReq *measInfo; /* Meas Req Info */ #endif @@ -307,9 +285,6 @@ RgInfL2MeasReq *measInfo; /* Meas Req Info */ S16 ret = ROK; RgInfL2MeasCfm measCfm; - TRC3(RgSchMacL2MeasReq) - - RG_IS_INST_VALID(pst->dstInst); inst = pst->dstInst - RG_INST_START; cellCb = rgCb[inst].cell; @@ -318,13 +293,13 @@ RgInfL2MeasReq *measInfo; /* Meas Req Info */ (cellCb->cellId != measInfo->cellId)) { RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,"unable to get the cellCb"); - RETVALUE(RFAILED); + return RFAILED; } /* Call L2M Function to store Meas req */ ret = rgL2mMeasReq(cellCb, measInfo, &err); if (ret != ROK) { - cmMemset((U8 *)&measCfm, 0, sizeof(RgInfL2MeasCfm)); + memset(&measCfm, 0, sizeof(RgInfL2MeasCfm)); measCfm.transId = measInfo->transId; measCfm.cellId = measInfo->cellId; measCfm.measType = measInfo->measType; @@ -334,9 +309,9 @@ RgInfL2MeasReq *measInfo; /* Meas Req Info */ RLOG_ARG2(L_ERROR,DBG_CELLID,measInfo->cellId, "Meas req Failed errType(%d) errCause(%d)", err.errType, err.errCause); - RETVALUE(RFAILED); + return RFAILED; } - RETVALUE(ret); + return (ret); } /* -- RgSchMacL2MeasReq-- */ /** @@ -354,30 +329,26 @@ RgInfL2MeasReq *measInfo; /* Meas Req Info */ * -# RFAILED **/ #ifdef ANSI -PUBLIC S16 RgSchMacL2MeasStopReq +S16 RgSchMacL2MeasStopReq ( Pst *pst, /* post structure */ RgInfL2MeasStopReq *measInfo /* Meas Req Info */ ) #else -PUBLIC S16 RgSchMacL2MeasStopReq(pst, measInfo) +S16 RgSchMacL2MeasStopReq(pst, measInfo) Pst *pst; /* post structure */ RgInfL2MeasStopReq *measInfo; /* Meas Req Info */ #endif { - S16 ret = ROK; - CmLList *node = NULLP; - RgL2MeasCb *measCb = NULLP; - U8 idx; - U8 qciVal; - Inst inst; - RgCellCb *cellCb = NULLP; - + S16 ret = ROK; + CmLList *node = NULLP; + RgL2MeasCb *measCb = NULLP; + uint8_t idx; + uint8_t qciVal; + Inst inst; + RgCellCb *cellCb = NULLP; RgInfL2MeasCfm measCfm; - TRC3(RgSchMacL2MeasStopReq) - - RG_IS_INST_VALID(pst->dstInst); inst = pst->dstInst - RG_INST_START; cellCb = rgCb[inst].cell; @@ -388,7 +359,7 @@ RgInfL2MeasStopReq *measInfo; /* Meas Req Info */ RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, "Unable to get the cellCb"); - RETVALUE(RFAILED); + return RFAILED; } node = cellCb->l2mList.first; while(node != NULLP) @@ -404,13 +375,13 @@ RgInfL2MeasStopReq *measInfo; /* Meas Req Info */ cmLListDelFrm(&cellCb->l2mList, &measCb->measLnk); rgFreeSBuf(inst,(Data**)&measCb, sizeof(RgL2MeasCb)); } - cmMemset((U8 *)&measCfm, 0, sizeof(RgInfL2MeasCfm)); + memset(&measCfm, 0, sizeof(RgInfL2MeasCfm)); measCfm.transId = measInfo->transId; measCfm.cellId = measInfo->cellId; measCfm.measType = measInfo->measType; measCfm.cfm.status = LCM_PRIM_OK; rgSndL2MeasStopCfm(cellCb, &measCfm); - RETVALUE(ret); + return (ret); } /* -- RgSchMacL2MeasStopReq-- */ /** @@ -428,13 +399,13 @@ RgInfL2MeasStopReq *measInfo; /* Meas Req Info */ * -# RFAILED **/ #ifdef ANSI -PUBLIC S16 RgSchMacL2MeasSendReq +S16 RgSchMacL2MeasSendReq ( Pst *pst, /* post structure */ RgInfL2MeasSndReq *measInfo /* Meas Req Info */ ) #else -PUBLIC S16 RgSchMacL2MeasSendReq(pst, measInfo) +S16 RgSchMacL2MeasSendReq(pst, measInfo) Pst *pst; /* post structure */ RgInfL2MeasSndReq *measInfo; /* Meas Req Info */ #endif @@ -443,9 +414,6 @@ RgInfL2MeasSndReq *measInfo; /* Meas Req Info */ RgCellCb *cellCb = NULLP; S16 ret = ROK; - TRC3(RgSchMacL2MeasSendReq) - - RG_IS_INST_VALID(pst->dstInst); inst = pst->dstInst - RG_INST_START; cellCb = rgCb[inst].cell; @@ -456,12 +424,12 @@ RgInfL2MeasSndReq *measInfo; /* Meas Req Info */ RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId, "Unable to get the cellCb"); - RETVALUE(RFAILED); + return RFAILED; } /*set sndL2Meas as applicatoin sent l2 meas info request*/ cellCb->sndL2Meas = TRUE; - RETVALUE(ret); + return (ret); }/*RgSchMacL2MeasSendReq*/ /** @brief This function inserts the MeasCb in to data base @@ -491,11 +459,9 @@ RgL2MeasCb *measCb; RgInfL2MeasReq *measInfo; #endif { - CmLList *lnk, *node; - RgL2MeasCb *oldMeasCb; - U16 diffTime; - - TRC3(rgL2mInsertMeasCb) + CmLList *lnk, *node; + RgL2MeasCb *oldMeasCb; + uint16_t diffTime; /* * 1. Check if l2mList has any entries. @@ -521,7 +487,7 @@ RgInfL2MeasReq *measInfo; { cell->l2mList.crnt = lnk; cmLListInsCrnt(&(cell->l2mList), node); - RETVALUE(ROK); + return ROK; } else { @@ -530,7 +496,7 @@ RgInfL2MeasReq *measInfo; } /* End of While */ cmLListAdd2Tail(&(cell->l2mList), node); - RETVALUE(ROK); + return ROK; } /* rgL2mInsertMeasCb */ /** @brief This function allocates memory from the heap @@ -561,7 +527,6 @@ RgErrInfo *err; RgL2MeasCb *measCb = NULLP; Inst inst = cell->macInst - RG_INST_START; - TRC3(rgL2mAllocMeasCb) if((rgAllocSBuf(inst,(Data **)&(measCb), sizeof(RgL2MeasCb))) == RFAILED) @@ -570,12 +535,12 @@ RgErrInfo *err; "Allocation of RgL2MeasCb failed"); err->errType = RGERR_L2M_MEASREQ; err->errCause = RGERR_RAM_MEM_EXHAUST; - RETVALUE(NULLP); + return (NULLP); } - cmMemcpy((U8 *)&measCb->measReq, (U8 *)measInfo, sizeof(RgInfL2MeasReq)); + memcpy(&measCb->measReq, measInfo, sizeof(RgInfL2MeasReq)); RGCPYTIMEINFO(cell->crntTime, measCb->startTime); - RETVALUE(measCb); + return (measCb); } /* rgL2mAllocMeasCb */ @@ -594,26 +559,24 @@ RgErrInfo *err; * -# RFAILED **/ #ifdef ANSI -PUBLIC S16 rgL2Meas +S16 rgL2Meas ( RgCellCb *cell ) #else -PUBLIC S16 rgL2Meas(cell) +S16 rgL2Meas(cell) RgCellCb *cell; #endif { CmLList *node = NULLP; RgL2MeasCb *measCb = NULLP; - RgInfL2MeasCfm measCfm; - U8 idx = 0; - U8 qciVal = 0; - U32 measPrd; /*LTE_L2_MEAS_PHASE2*/ + RgInfL2MeasCfm measCfm; + uint8_t idx = 0; + uint8_t qciVal = 0; + uint32_t measPrd; /*LTE_L2_MEAS_PHASE2*/ CmLteTimingInfo crntTime; - Inst inst = cell->macInst - RG_INST_START; + Inst inst = cell->macInst - RG_INST_START; - TRC3(rgL2Meas) - node = cell->l2mList.first; while(node != NULLP) @@ -622,7 +585,7 @@ RgCellCb *cell; node = node->next; crntTime = cell->crntTime; - if(cell->crntTime.sfn == 0 && (cell->crntTime.subframe % RG_NUM_SUB_FRAMES) == 0) + if(cell->crntTime.sfn == 0 && (cell->crntTime.slot % RG_NUM_SUB_FRAMES) == 0) { measCb->sfnCycle++; } @@ -633,7 +596,7 @@ RgCellCb *cell; /*LTE_L2_MEAS_PHASE2*/ if (cell->sndL2Meas || measPrd == measCb->measReq.timePrd) { - cmMemset((U8 *)&measCfm, 0, sizeof(RgInfL2MeasCfm)); + memset(&measCfm, 0, sizeof(RgInfL2MeasCfm)); for(idx = 0; idx < measCb->measReq.t.prbReq.numQci; idx++) { qciVal = measCb->measReq.t.prbReq.qci[idx]; @@ -669,7 +632,7 @@ RgCellCb *cell; continue; } } - RETVALUE(ROK); + return ROK; } /* rgL2MEas */ #endif /* LTE_L2_MEAS */