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 #include "envopt.h" /* Environment options */
20 #include "envdep.h" /* Environment dependent */
21 #include "envind.h" /* Environment independent */
22 #include "gen.h" /* General */
23 #include "ssi.h" /* System services */
29 #include "gen.x" /* general */
30 #include "ssi.x" /* system services */
31 #include "cm_tkns.x" /* Common Token Definitions */
32 #include "cm_llist.x" /* Common Link List Definitions */
33 #include "cm_lib.x" /* Common Library Definitions */
34 #include "cm_hash.x" /* Common Hash List Definitions */
35 #include "cm_lte.x" /* Common LTE Defines */
37 #include "mac_interface.h"
39 /**************************************************************************
40 * @brief Function to pack Loose Coupled
41 * MAC cell config parameters required by MAC
45 * Function : packLcMacCellCfg
48 * packs the macCellCfg parameters
50 * @param[in] Pst *pst, Post structure of the primitive.
51 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
52 * @return ROK - success
55 ***************************************************************************/
56 S16 packLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
58 /* we are now implemented only light wieght lossely coupled interface */
62 /**************************************************************************
63 * @brief Function to pack light weight Loose Coupled
64 * MAC cell config parameters required by MAC
68 * Function : packLwLcMacCellCfg
71 * packs the macCellCfg parameters
73 * @param[in] Pst *pst, Post structure of the primitive.
74 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
75 * @return ROK - success
78 ***************************************************************************/
79 S16 packLwLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
83 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
88 /* pack the address of the structure */
89 CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
91 RETVALUE(SPstTsk(pst,mBuf));
94 /**************************************************************************
95 * @brief Function to pack Loose Coupled
96 * MAC cell config parameters required by MAC
100 * Function : unpackDuMacCellCfg
103 * packs the macCellCfg parameters
105 * @param[in] DuMacCellCfgReq func; function pointer
106 * @param[in] Pst *pst, Post structure of the primitive.
107 * @param[in] Buffer *mBuf
108 * @return ROK - success
111 ***************************************************************************/
112 void unpackDuMacCellCfg(
113 DuMacCellCfgReq func,
118 MacCellCfg *macCellCfg;
120 if(pst->selector == DU_SELECTOR_LWLC)
122 /* unpack the address of the structure */
123 CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf);
124 ret = (*func)(pst, macCellCfg);
128 /* only LWLC is implemented now */
135 /**************************************************************************
136 * @brief Function to pack Loose Coupled
137 * MAC cell config confirm message
141 * Function : cmPackLcMacCellCfgCfm
144 * packs the transaction ID
146 * @param[in] Pst *pst, Post structure of the primitive.
147 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
148 * @return ROK - success
151 ***************************************************************************/
152 U16 cmPackLcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
154 Buffer *mBuf = NULLP;
155 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
160 /* pack the transaction ID in CNF structure */
161 CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
163 RETVALUE(SPstTsk(pst,mBuf));
166 /**************************************************************************
167 * @brief Function to pack light weight Loose Coupled
168 * MAC cell config confirm message
172 * Function : cmPackLwlcMacCellCfgCfm
175 * packs the transaction ID
177 * @param[in] Pst *pst, Post structure of the primitive.
178 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
179 * @return ROK - success
182 ***************************************************************************/
183 U16 cmPackLwlcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
188 /**************************************************************************
189 * @brief Function to pack MAC cell config confirm message
193 * Function : unpackMacCellCfgCfm
196 * packs the transaction ID
198 * @param[in] DuMacCellCfgCfm func; function pointer
199 * @param[in] Pst *pst, Post structure of the primitive.
200 * @param[in] Buffer *mBuf
201 * @return ROK - success
204 ***************************************************************************/
205 S16 unpackMacCellCfgCfm(
206 DuMacCellCfgCfm func,
210 MacCellCfgCfm macCellCfgCfm;
212 if(pst->selector == DU_SELECTOR_LC)
214 /* unpack the transaction ID in CNF structure */
215 CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
217 RETVALUE((*func)(&macCellCfgCfm));
221 /* only loose coupling is suported */