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 */
27 #include "gen.x" /* general */
28 #include "ssi.x" /* system services */
29 #include "cm_tkns.x" /* Common Token Definitions */
30 #include "cm_llist.x" /* Common Link List Definitions */
31 #include "cm_lib.x" /* Common Library Definitions */
32 #include "cm_hash.x" /* Common Hash List Definitions */
33 #include "cm_lte.x" /* Common LTE Defines */
35 #include "mac_interface.h"
37 /**************************************************************************
38 * @brief Function to pack Loose Coupled
39 * MAC cell config parameters required by MAC
43 * Function : packLcMacCellCfg
46 * packs the macCellCfg parameters
48 * @param[in] Pst *pst, Post structure of the primitive.
49 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
50 * @return ROK - success
53 ***************************************************************************/
54 S16 packLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
59 /**************************************************************************
60 * @brief Function to pack tightly Coupled
61 * MAC cell config parameters required by MAC
65 * Function : packTcMacCellCfg
68 * packs the macCellCfg parameters
70 * @param[in] Pst *pst, Post structure of the primitive.
71 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
72 * @return ROK - success
75 ***************************************************************************/
76 S16 packTcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
81 /**************************************************************************
82 * @brief Function to pack light weight Loose Coupled
83 * MAC cell config parameters required by MAC
87 * Function : packLwLcMacCellCfg
90 * packs the macCellCfg parameters
92 * @param[in] Pst *pst, Post structure of the primitive.
93 * @param[in] MacCellCfg *macCellCfg, mac cell config parameters.
94 * @return ROK - success
97 ***************************************************************************/
98 S16 packLwLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
100 Buffer *mBuf = NULLP;
102 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
107 /* pack the address of the structure */
108 CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
110 RETVALUE(SPstTsk(pst,mBuf));
113 /**************************************************************************
114 * @brief Function to pack Loose Coupled
115 * MAC cell config parameters required by MAC
119 * Function : unpackLwLcMacCellCfg
122 * packs the macCellCfg parameters
124 * @param[in] DuMacCellCfgReq func; function pointer
125 * @param[in] Pst *pst, Post structure of the primitive.
126 * @param[in] Buffer *mBuf
127 * @return ROK - success
130 ***************************************************************************/
131 void cmUnpackLwLcMacCellCfg(
132 DuMacCellCfgReq func,
136 MacCellCfg *macCellCfg;
138 /* unpack the address of the structure */
139 CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf);
141 RETVALUE((*func)(pst, macCellCfg));
144 /**************************************************************************
145 * @brief Function to pack Loose Coupled
146 * MAC cell config confirm message
150 * Function : cmPackLcMacCellCfgCfm
153 * packs the transaction ID
155 * @param[in] Pst *pst, Post structure of the primitive.
156 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
157 * @return ROK - success
160 ***************************************************************************/
161 U16 cmPackLcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
163 Buffer *mBuf = NULLP;
164 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
169 /* pack the transaction ID in CNF structure */
170 CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
172 RETVALUE(SPstTsk(pst,mBuf));
175 /**************************************************************************
176 * @brief Function to pack tightly Coupled
177 * MAC cell config confirm message
181 * Function : cmPackTcMacCellCfgCfm
184 * packs the transaction ID
186 * @param[in] Pst *pst, Post structure of the primitive.
187 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
188 * @return ROK - success
191 ***************************************************************************/
192 U16 cmPackTcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
197 /**************************************************************************
198 * @brief Function to pack light weight Loose Coupled
199 * MAC cell config confirm message
203 * Function : cmPackLwlcMacCellCfgCfm
206 * packs the transaction ID
208 * @param[in] Pst *pst, Post structure of the primitive.
209 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
210 * @return ROK - success
213 ***************************************************************************/
214 U16 cmPackLwlcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
219 /**************************************************************************
220 * @brief Function to pack MAC cell config confirm message
224 * Function : cmUnpackLcMacCellCfgCfm
227 * packs the transaction ID
229 * @param[in] DuMacCellCfgCfm func; function pointer
230 * @param[in] Pst *pst, Post structure of the primitive.
231 * @param[in] Buffer *mBuf
232 * @return ROK - success
235 ***************************************************************************/
236 S16 cmUnpackLcMacCellCfgCfm(
237 DuMacCellCfgCfm func,
241 MacCellCfgCfm macCellCfgCfm;
242 /* pack the transaction ID in CNF structure */
243 CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
245 RETVALUE((*func)(&macCellCfgCfm));