1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* Contains common utility definitions to be used at MAC */
21 #define MAX_SHORT_BSR_TABLE_ENTRIES 32
22 #define MAC_MEM_REGION 4
25 /* allocate and zero out a MAC static buffer */
26 #define MAC_ALLOC(_datPtr, _size) \
29 _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL, \
30 (Data **)&_datPtr, _size); \
33 cmMemset((uint8_t *)_datPtr, 0, _size); \
41 /* free a static buffer */
42 #define MAC_FREE(_datPtr, _size) \
46 SPutSBuf(MAC_MEM_REGION, MAC_POOL, \
47 (Data *)_datPtr, _size); \
51 /* Allocate shared memory to be used for LWLC
52 * during inter-layer communication */
53 #define MAC_ALLOC_SHRABL_BUF(_buf, _size) \
55 if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL, \
56 (Data **)&_buf, (Size) _size, 0) == ROK) \
58 cmMemset((uint8_t *)(_buf), 0, _size); \
66 /* Free shared memory, received through LWLC */
67 #define MAC_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \
71 (Void) SPutStaticBuffer(_region, _pool, \
72 (Data *) _buf, (Size) _size, 0); \
77 /* Fill Pst structure for sending msg from MAC to DU APP */
78 #define FILL_PST_MAC_TO_DUAPP(_pst, _event) \
80 _pst.selector = ODU_SELECTOR_LWLC; \
81 _pst.srcEnt = ENTRG; \
82 _pst.dstEnt = ENTDUAPP; \
84 _pst.srcInst = macCb.macInst; \
85 _pst.dstProcId = macCb.procId; \
86 _pst.srcProcId = macCb.procId; \
87 _pst.region = MAC_MEM_REGION; \
88 _pst.pool = MAC_POOL; \
89 _pst.event = _event; \
95 /* Fill Pst structure for sending msg from MAC to SCH */
96 #define FILL_PST_MAC_TO_SCH(_pst, _event) \
98 _pst.selector = ODU_SELECTOR_TC; \
99 _pst.srcEnt = ENTRG; \
100 _pst.dstEnt = ENTRG; \
102 _pst.srcInst = macCb.macInst; \
103 _pst.dstProcId = macCb.procId; \
104 _pst.srcProcId = macCb.procId; \
105 _pst.region = MAC_MEM_REGION; \
106 _pst.pool = MAC_POOL; \
107 _pst.event = _event; \
113 /* Fills Pst to send msg to RLC */
114 #define FILL_PST_MAC_TO_RLC(_pst, _dstInst, _event) \
116 pst.selector = ODU_SELECTOR_LWLC; \
117 pst.srcEnt = ENTRG; \
118 pst.dstEnt = ENTKW; \
119 pst.dstInst = _dstInst; \
120 pst.srcInst = macCb.macInst; \
121 pst.dstProcId = macCb.procId; \
122 pst.srcProcId = macCb.procId; \
123 pst.region = MAC_MEM_REGION; \
124 pst.pool = MAC_POOL; \
125 pst.event = _event; \
131 /**********************************************************************
133 **********************************************************************/