X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Frg.h;h=2253741e2a93a3165a943699838e04d2a98092d6;hb=de6a435729e3cad9d4a66329080b8206a64f452c;hp=6850884f40c631afa5c25d16bd1246fd4ce957da;hpb=5625a52ad68f6ad93684e68bbbdbaef0d462cf9a;p=o-du%2Fl2.git diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index 6850884f4..2253741e2 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -36,8 +36,6 @@ #ifndef __RGH__ #define __RGH__ -#include "rl_interface.h" -#include "rl_common.h" #ifdef L2_OPTMZ @@ -52,8 +50,8 @@ #define RG_MAC_HDR_SIZE 250 #define RG_MAC_CE_SIZE 250 -U32 MacPtrAddress; -U32 macHeader[2]; +uint32_t MacPtrAddress; +uint32_t macHeader[2]; #define RG_ADD_DBuf(_dBuf,_size,_mBuf)\ { \ @@ -62,7 +60,7 @@ U32 macHeader[2]; ssGetDBufOfSize(mInfo->region,_size, &_dBuf); \ SUpdMsg(_mBuf, _dBuf,0);\ _dBuf->b_wptr = _dBuf->b_rptr = (_dBuf->b_datap->db_base + 5);\ - MacPtrAddress = (U32)_dBuf->b_wptr;\ + MacPtrAddress = (uint32_t)_dBuf->b_wptr;\ } #endif @@ -244,20 +242,24 @@ U32 macHeader[2]; #define RG_MAX_DL_HARQ_NUM 8 #endif +/* Free shared memory, received through LWLC */ +#define MAC_FREE_MEM(_region, _pool, _datPtr, _size) \ + MAC_FREE(_datPtr, _size); \ + #define RG_LCG_ISCFGD(lcg) ((lcg)->lcgId != RG_INVALID_LCG_ID) /* Corrected the check for dlCcchId */ #define RG_DLCCCH_ISCFGD(cell) ((cell)->dlCcchId != RG_INVALID_LC_ID) #define RG_ULCCCH_ISCFGD(cell) ((cell)->ulCcchId != RG_INVALID_LC_ID) /* After merging from 2.1 to 2.2 */ #define RG_CALC_SF_DIFF(_time1, _time2)\ - (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.subframe) < (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe)?\ - ((_time1.sfn+RG_MAX_SFN)*RG_NUM_SUB_FRAMES_5G+_time1.subframe) -\ - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe) : \ - (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.subframe) - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe) + (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.slot) < (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot)?\ + ((_time1.sfn+RG_MAX_SFN)*RG_NUM_SUB_FRAMES_5G+_time1.slot) -\ + (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot) : \ + (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.slot) - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot) /*LTE_L2_MEAS_PHASE2*/ #define RG_CALC_SFN_SF_DIFF(_time1,_sfnCycle, _time2)\ -(((_time1.sfn+RG_MAX_SFN * _sfnCycle)*RG_NUM_SUB_FRAMES_5G) + _time1.subframe -\ -(_time2.sfn*RG_NUM_SUB_FRAMES_5G + _time2.subframe)) +(((_time1.sfn+RG_MAX_SFN * _sfnCycle)*RG_NUM_SUB_FRAMES_5G) + _time1.slot -\ +(_time2.sfn*RG_NUM_SUB_FRAMES_5G + _time2.slot)) #define RG_EXT_LCID(_lcId, _byte) {\ (_lcId) = (_byte) & RG_LCID_MASK; \ @@ -281,8 +283,8 @@ U32 macHeader[2]; ssGetDBufOfSize(mInfo->region,_size, &_padBuf); \ if (_padBuf == NULLP) \ { \ - RLOG0(L_ERROR, "RGERR_MUX_BLD_CEHDR_FAIL");\ - RETVALUE(RFAILED);\ + DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_CEHDR_FAIL");\ + return RFAILED;\ } \ if (mInfo->endptr == NULLP) { \ sduEnd = _sduBuf; \ @@ -311,26 +313,21 @@ U32 macHeader[2]; } #define RGADDTOCRNTTIME(crntTime, toFill, incr) \ - if ((crntTime.subframe + incr) > (RG_NUM_SUB_FRAMES_5G - 1)) \ + if ((crntTime.slot + incr) > (RG_NUM_SUB_FRAMES_5G - 1)) \ toFill.sfn = (crntTime.sfn + 1); \ else \ toFill.sfn = crntTime.sfn; \ - toFill.subframe = (crntTime.subframe + incr) % RG_NUM_SUB_FRAMES_5G; \ + toFill.slot = (crntTime.slot + incr) % RG_NUM_SUB_FRAMES_5G; \ if (toFill.sfn >= RG_MAX_SFN) \ { \ - toFill.hSfn = (crntTime.hSfn + 1)%RG_MAX_SFN; \ toFill.sfn%=RG_MAX_SFN; \ } \ - else \ - { \ - toFill.hSfn = crntTime.hSfn; \ - } #define RGSUBFRMCRNTTIME(crntTime, toFill, dcr) \ { \ if (crntTime.sfn == 0) \ { \ - if ((crntTime.subframe - (dcr)) < 0) \ + if ((crntTime.slot - (dcr)) < 0) \ { \ toFill.sfn = RG_MAX_SFN - 1; \ } \ @@ -341,21 +338,20 @@ U32 macHeader[2]; } \ else \ { \ - if ((crntTime.subframe - (dcr)) < 0) \ + if ((crntTime.slot - (dcr)) < 0) \ { \ toFill.sfn = crntTime.sfn - 1; \ } \ else \ toFill.sfn = crntTime.sfn; \ } \ -toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_SUB_FRAMES_5G); \ +toFill.slot = (RG_NUM_SUB_FRAMES_5G + crntTime.slot - (dcr)) % (RG_NUM_SUB_FRAMES_5G); \ } #define RGCPYTIMEINFO(src, dst) \ - dst.hSfn = src.hSfn; \ - dst.sfn = src.sfn; \ - dst.subframe = src.subframe; -#define RG_TIMEINFO_SAME(x, y) ((x.sfn == y.sfn) && (x.subframe == y.subframe)) + dst.sfn = src.sfn; \ + dst.slot = src.slot; +#define RG_TIMEINFO_SAME(x, y) ((x.sfn == y.sfn) && (x.slot == y.slot)) #define rgPBuf(_inst) rgCb[_inst].rgInit.prntBuf @@ -378,13 +374,13 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S #define RG_NULL_CHECK(_inst, _ptr ) \ if((_ptr) == NULLP) \ { \ - RGDBGERRNEW(_inst, (rgPBuf(_inst),"Null Pointer detected"));\ + DU_LOG("\nERROR --> MAC : Null Pointer detected");\ SExit();\ } #define RG_ARRAY_BOUND_CHECK(_inst, _array, _idxVal) \ if((_idxVal) >= (sizeof(_array)/sizeof(_array[0]))) \ { \ - RGDBGERRNEW(_inst, (rgPBuf(_inst),"Array Bound Check Failed"));\ + DU_LOG("\nERROR --> MAC : Array Bound Check Failed");\ SExit();\ } #else @@ -427,7 +423,7 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S #ifdef L2_OPTMZ #define RG_FREE_TB(_tb)\ {\ - U32 lchIdx, pduIdx;\ + uint32_t lchIdx, pduIdx;\ SResetMBuf(_tb->macHdr);\ SResetMBuf(_tb->macCes);\ _tb->tbPres = FALSE;\ @@ -451,7 +447,7 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S #define RG_FREE_SAVED_TB(_tb)\ {\ - U32 lchIdx, pduIdx;\ + uint32_t lchIdx, pduIdx;\ RG_FREE_MSG(_tb->macHdr);\ RG_FREE_MSG(_tb->macCes);\ _tb->tbPres = FALSE;\ @@ -491,7 +487,7 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S **********************************************************/ #define RG_DROP_RGUDDATREQ_MBUF(_datReq)\ {\ - U32 idx5,idx6,idx7;\ + uint32_t idx5,idx6,idx7;\ for (idx5=0; idx5 < _datReq.nmbOfTbs; idx5++)\ {\ for (idx6=0; idx6 < _datReq.datReqTb[idx5].nmbLch; idx6++)\ @@ -607,15 +603,15 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S #endif #define RG_CALC_SF_DIFF(_time1, _time2)\ - (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.subframe) < (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe)?\ - ((_time1.sfn+RG_MAX_SFN)*RG_NUM_SUB_FRAMES_5G+_time1.subframe) -\ - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe) : \ - (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.subframe) - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.subframe) + (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.slot) < (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot)?\ + ((_time1.sfn+RG_MAX_SFN)*RG_NUM_SUB_FRAMES_5G+_time1.slot) -\ + (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot) : \ + (_time1.sfn*RG_NUM_SUB_FRAMES_5G+_time1.slot) - (_time2.sfn*RG_NUM_SUB_FRAMES_5G+_time2.slot) #define RG_TTI_CYCLE_INVLD 0xFFFFFFFF #define RG_CALC_TTI_CNT(_cellCb, _ttiCnt)\ _ttiCnt = (RG_NUM_SUB_FRAMES_5G * (_cellCb->crntTime.sfn + (_cellCb->ttiCycle * 1024)) )+\ - _cellCb->crntTime.subframe; + _cellCb->crntTime.slot; #endif /* LTE_L2_MEAS */ /* Tuned according to TDD Cfg Mode2 and 2UE/TTI. @@ -644,7 +640,7 @@ toFill.subframe = (RG_NUM_SUB_FRAMES_5G + crntTime.subframe - (dcr)) % (RG_NUM_S {\ if(_inst >= RG_MAX_INST)\ {\ - RETVALUE(RFAILED);\ + return RFAILED;\ }\ } @@ -672,7 +668,7 @@ typedef enum { \ if(rgCb[_inst].rgInit.logMask & SS_DIAG_LVL0) \ { \ - ssDiagFix(_tknId, _splArgEnum, ENTRG, rgCb[_inst].rgInit.inst, SS_DIAG_LVL0, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ + ssDiagFix(_tknId, _splArgEnum, ENTMAC, rgCb[_inst].rgInit.inst, SS_DIAG_LVL0, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ } \ } @@ -683,7 +679,7 @@ typedef enum { \ if(rgCb[_inst].rgInit.logMask & SS_DIAG_LVL1) \ { \ - ssDiagFix(_tknId, _splArgEnum, ENTRG, rgCb[_inst].rgInit.inst, SS_DIAG_LVL1, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ + ssDiagFix(_tknId, _splArgEnum, ENTMAC, rgCb[_inst].rgInit.inst, SS_DIAG_LVL1, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ } \ } @@ -694,7 +690,7 @@ typedef enum { \ if(rgCb[_inst].rgInit.logMask & SS_DIAG_LVL2) \ { \ - ssDiagFix(_tknId, _splArgEnum, ENTRG, rgCb[_inst].rgInit.inst, SS_DIAG_LVL2, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ + ssDiagFix(_tknId, _splArgEnum, ENTMAC, rgCb[_inst].rgInit.inst, SS_DIAG_LVL2, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ } \ } @@ -705,7 +701,7 @@ typedef enum { \ if(rgCb[_inst].rgInit.logMask & SS_DIAG_LVL3) \ { \ - ssDiagFix(_tknId, _splArgEnum, ENTRG, rgCb[_inst].rgInit.inst, SS_DIAG_LVL3, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ + ssDiagFix(_tknId, _splArgEnum, ENTMAC, rgCb[_inst].rgInit.inst, SS_DIAG_LVL3, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ } \ } @@ -716,7 +712,7 @@ typedef enum { \ if(rgCb[_inst].rgInit.logMask & SS_DIAG_LVL4) \ { \ - ssDiagFix(_tknId, _splArgEnum, ENTRG, rgCb[_inst].rgInit.inst, SS_DIAG_LVL4, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ + ssDiagFix(_tknId, _splArgEnum, ENTMAC, rgCb[_inst].rgInit.inst, SS_DIAG_LVL4, SS_DIAG_MSG_TYPE_FIXED, _splArg, _arg1, _arg2, _arg3, _arg4, _string);\ } \ } @@ -754,7 +750,6 @@ typedef enum { \ } #endif - #endif /* __RGH__ */ /**********************************************************************