X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Frg.h;h=2c039006606a844f31190298ad3d6d68dee9d871;hb=0bdd575f55257e64b4becb4cee0df0dab2bac3fa;hp=d416563362b6e5d4c80f4898d4dc0485a6ab71ad;hpb=43f9a063a851c5318a609e9966cdc0b30f0abaf5;p=o-du%2Fl2.git diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index d41656336..2c0390066 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -244,7 +244,7 @@ U32 macHeader[2]; #define RG_MAX_DL_HARQ_NUM 8 #endif -#define MAC_MEM_REGION 4 +#define MAC_MEM_REGION 4 #define MAC_POOL 1 /* allocate and zero out a MAC static buffer */ #define MAC_ALLOC(_datPtr, _size) \ @@ -264,20 +264,52 @@ U32 macHeader[2]; SPutSBuf(MAC_MEM_REGION, MAC_POOL, \ (Data *)_datPtr, _size); +/* Allocate shared memory to be used for LWLC + * during inter-layer communication */ +#define MAC_ALLOC_SHRABL_BUF(_buf, _size) \ +{ \ + if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL, \ + (Data **)&_buf, (Size) _size, 0) == ROK) \ + { \ + cmMemset((U8 *)(_buf), 0, _size); \ + } \ + else \ + { \ + (_buf) = NULLP; \ + } \ +} + +/* Free shared memory, received through LWLC */ +#define MAC_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \ +{ \ + if (_buf != NULLP) \ + { \ + (Void) SPutStaticBuffer(_region, _pool, \ + (Data *) _buf, (Size) _size, 0); \ + _buf = NULLP; \ + } \ +} + +/* Free shared memory, received through LWLC */ +#define MAC_FREE_MEM(_region, _pool, _datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(_region, _pool,(Data *)_datPtr, _size); \ + _datPtr = NULL; + #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; \ @@ -331,26 +363,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; \ } \ @@ -361,21 +388,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 @@ -627,15 +653,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.