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 */
28 #include "gen.x" /* general */
29 #include "ssi.x" /* system services */
30 #include "cm_tkns.x" /* Common Token Definitions */
31 #include "cm_llist.x" /* Common Link List Definitions */
32 #include "cm_lib.x" /* Common Library Definitions */
33 #include "cm_hash.x" /* Common Hash List Definitions */
34 #include "cm_lte.x" /* Common LTE Defines */
37 #include "du_app_mac_inf.h"
39 /**************************************************************************
40 * @brief Function to pack Loose Coupled
41 * MAC cell config parameters required by MAC
45 * Function : packMacCellCfg
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 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
58 if(pst->selector == DU_SELECTOR_LC)
60 /* we are now implemented only light wieght lossely coupled interface */
63 else if(pst->selector == DU_SELECTOR_LWLC)
67 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
72 /* pack the address of the structure */
73 CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
75 RETVALUE(SPstTsk(pst,mBuf));
79 /**************************************************************************
80 * @brief Function to pack Loose Coupled
81 * MAC cell config parameters required by MAC
85 * Function : unpackDuMacCellCfg
88 * packs the macCellCfg parameters
90 * @param[in] DuMacCellCfgReq func; function pointer
91 * @param[in] Pst *pst, Post structure of the primitive.
92 * @param[in] Buffer *mBuf
93 * @return ROK - success
96 ***************************************************************************/
97 void unpackDuMacCellCfg(
103 MacCellCfg *macCellCfg;
105 if(pst->selector == DU_SELECTOR_LWLC)
107 /* unpack the address of the structure */
108 CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf);
109 ret = (*func)(pst, macCellCfg);
113 /* only LWLC is implemented now */
120 /**************************************************************************
121 * @brief Function to pack Loose Coupled
122 * MAC cell config confirm message
126 * Function : cmPackMacCellCfgCfm
129 * packs the transaction ID
131 * @param[in] Pst *pst, Post structure of the primitive.
132 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
133 * @return ROK - success
136 ***************************************************************************/
137 U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
139 if(pst->selector == DU_SELECTOR_LC)
141 Buffer *mBuf = NULLP;
142 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
147 /* pack the transaction ID in CNF structure */
148 CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
150 RETVALUE(SPstTsk(pst,mBuf));
152 else if(pst->selector == DU_SELECTOR_LWLC)
154 /* only LC is supported */
159 /**************************************************************************
160 * @brief Function to pack MAC cell config confirm message
164 * Function : unpackMacCellCfgCfm
167 * packs the transaction ID
169 * @param[in] DuMacCellCfgCfm func; function pointer
170 * @param[in] Pst *pst, Post structure of the primitive.
171 * @param[in] Buffer *mBuf
172 * @return ROK - success
175 ***************************************************************************/
176 S16 unpackMacCellCfgCfm(
177 DuMacCellCfgCfm func,
181 MacCellCfgCfm macCellCfgCfm;
183 if(pst->selector == DU_SELECTOR_LC)
185 /* unpack the transaction ID in CNF structure */
186 CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
188 RETVALUE((*func)(&macCellCfgCfm));
192 /* only loose coupling is suported */
196 /**********************************************************************
198 **********************************************************************/