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 U16 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 DU_LOG("\nDU-APP : MAC CELL config sent");
76 RETVALUE(SPstTsk(pst,mBuf));
80 /**************************************************************************
81 * @brief Function to pack Loose Coupled
82 * MAC cell config parameters required by MAC
86 * Function : unpackDuMacCellCfg
89 * packs the macCellCfg parameters
91 * @param[in] DuMacCellCfgReq func; function pointer
92 * @param[in] Pst *pst, Post structure of the primitive.
93 * @param[in] Buffer *mBuf
94 * @return ROK - success
97 ***************************************************************************/
98 void unpackDuMacCellCfg(
104 MacCellCfg *macCellCfg;
106 if(pst->selector == DU_SELECTOR_LWLC)
108 /* unpack the address of the structure */
109 CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf);
110 ret = (*func)(pst, macCellCfg);
114 /* only LWLC is implemented now */
121 /**************************************************************************
122 * @brief Function to pack Loose Coupled
123 * MAC cell config confirm message
127 * Function : packMacCellCfgCfm
130 * packs the transaction ID
132 * @param[in] Pst *pst, Post structure of the primitive.
133 * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm.
134 * @return ROK - success
137 ***************************************************************************/
138 U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
140 if(pst->selector == DU_SELECTOR_LC)
142 Buffer *mBuf = NULLP;
143 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
148 /* pack the transaction ID in CNF structure */
149 CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
151 RETVALUE(SPstTsk(pst,mBuf));
153 else if(pst->selector == DU_SELECTOR_LWLC)
155 /* only LC is supported */
161 /**************************************************************************
162 * @brief Function to pack MAC cell config confirm message
166 * Function : unpackMacCellCfgCfm
169 * packs the transaction ID
171 * @param[in] DuMacCellCfgCfm func; function pointer
172 * @param[in] Pst *pst, Post structure of the primitive.
173 * @param[in] Buffer *mBuf
174 * @return ROK - success
177 ***************************************************************************/
178 U16 unpackMacCellCfgCfm(
179 DuMacCellCfgCfm func,
183 MacCellCfgCfm macCellCfgCfm;
185 if(pst->selector == DU_SELECTOR_LC)
187 /* unpack the transaction ID in CNF structure */
188 CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
190 RETVALUE((*func)(&macCellCfgCfm));
194 /* only loose coupling is suported */
199 /**********************************************************************
201 **********************************************************************/