macCellCfg
[o-du/l2.git] / src / cm / mac_interface.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
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 */
24 #include "ss_queue.h"
25 #include "ss_task.h"
26 #include "ss_msg.h"
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 */
34
35 #include "mac_interface.h"
36
37 /**************************************************************************
38  * @brief Function to pack Loose Coupled 
39  *        MAC cell config parameters required by MAC
40  *
41  * @details
42  *
43  *      Function : packLcMacCellCfg
44  *
45  *      Functionality:
46  *           packs the macCellCfg parameters
47  *
48  * @param[in] Pst     *pst, Post structure of the primitive.
49  * @param[in] MacCellCfg  *macCellCfg, mac cell config parameters.
50  * @return ROK     - success
51  *         RFAILED - failure
52  *
53  ***************************************************************************/
54 S16 packLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
55 {
56    return ROK;
57 }
58
59 /**************************************************************************
60  * @brief Function to pack tightly Coupled 
61  *        MAC cell config parameters required by MAC
62  *
63  * @details
64  *
65  *      Function : packTcMacCellCfg
66  *
67  *      Functionality:
68  *           packs the macCellCfg parameters
69  *
70  * @param[in] Pst     *pst, Post structure of the primitive.
71  * @param[in] MacCellCfg  *macCellCfg, mac cell config parameters.
72  * @return ROK     - success
73  *         RFAILED - failure
74  *
75  ***************************************************************************/
76 S16 packTcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
77 {
78    return ROK;
79 }
80
81 /**************************************************************************
82  * @brief Function to pack light weight Loose Coupled 
83  *        MAC cell config parameters required by MAC
84  *
85  * @details
86  *
87  *      Function : packLwLcMacCellCfg
88  *
89  *      Functionality:
90  *           packs the macCellCfg parameters
91  *
92  * @param[in] Pst     *pst, Post structure of the primitive.
93  * @param[in] MacCellCfg  *macCellCfg, mac cell config parameters.
94  * @return ROK     - success
95  *         RFAILED - failure
96  *
97  ***************************************************************************/
98 S16 packLwLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
99 {
100    Buffer *mBuf = NULLP;
101
102    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
103    {
104       RETVALUE(RFAILED);
105    }
106
107    /* pack the address of the structure */
108    CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
109
110    RETVALUE(SPstTsk(pst,mBuf));
111 }
112
113 /**************************************************************************
114  * @brief Function to pack Loose Coupled 
115  *        MAC cell config parameters required by MAC
116  *
117  * @details
118  *
119  *      Function : unpackLwLcMacCellCfg
120  *
121  *      Functionality:
122  *           packs the macCellCfg parameters
123  *
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
128  *         RFAILED - failure
129  *
130  ***************************************************************************/
131 void cmUnpackLwLcMacCellCfg(
132    DuMacCellCfgReq func,
133    Pst *pst,
134    Buffer *mBuf)
135 {
136    MacCellCfg *macCellCfg;
137
138    /* unpack the address of the structure */
139    CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf);
140
141    RETVALUE((*func)(pst, macCellCfg));
142 }
143
144 /**************************************************************************
145  * @brief Function to pack Loose Coupled 
146  *        MAC cell config confirm message
147  *
148  * @details
149  *
150  *      Function : cmPackLcMacCellCfgCfm
151  *
152  *      Functionality:
153  *           packs the transaction ID  
154  *
155  * @param[in] Pst     *pst, Post structure of the primitive.
156  * @param[in] MacCellCfgCfm  *macCellCfgCfm, mac cell config confirm.
157  * @return ROK     - success
158  *         RFAILED - failure
159  *
160  ***************************************************************************/
161 U16 cmPackLcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
162 {
163    Buffer *mBuf = NULLP;
164    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
165    {
166       RETVALUE(RFAILED);
167    }
168
169    /* pack the transaction ID in CNF structure */
170    CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
171
172    RETVALUE(SPstTsk(pst,mBuf));
173 }
174
175 /**************************************************************************
176  * @brief Function to pack tightly Coupled 
177  *        MAC cell config confirm message
178  *
179  * @details
180  *
181  *      Function : cmPackTcMacCellCfgCfm
182  *
183  *      Functionality:
184  *           packs the transaction ID  
185  *
186  * @param[in] Pst     *pst, Post structure of the primitive.
187  * @param[in] MacCellCfgCfm  *macCellCfgCfm, mac cell config confirm.
188  * @return ROK     - success
189  *         RFAILED - failure
190  *
191  ***************************************************************************/
192 U16 cmPackTcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
193 {
194    return ROK;
195 }
196
197 /**************************************************************************
198  * @brief Function to pack light weight Loose Coupled 
199  *        MAC cell config confirm message
200  *
201  * @details
202  *
203  *      Function : cmPackLwlcMacCellCfgCfm
204  *
205  *      Functionality:
206  *           packs the transaction ID  
207  *
208  * @param[in] Pst     *pst, Post structure of the primitive.
209  * @param[in] MacCellCfgCfm  *macCellCfgCfm, mac cell config confirm.
210  * @return ROK     - success
211  *         RFAILED - failure
212  *
213  ***************************************************************************/
214 U16 cmPackLwlcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
215 {
216    return ROK;
217 }
218
219 /**************************************************************************
220  * @brief Function to pack MAC cell config confirm message
221  *
222  * @details
223  *
224  *      Function : cmUnpackLcMacCellCfgCfm
225  *
226  *      Functionality:
227  *           packs the transaction ID  
228  *
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
233  *         RFAILED - failure
234  *
235  ***************************************************************************/
236 S16 cmUnpackLcMacCellCfgCfm(
237    DuMacCellCfgCfm func, 
238    Pst *pst,
239    Buffer *mBuf)
240 {
241    MacCellCfgCfm macCellCfgCfm;
242    /* pack the transaction ID in CNF structure */
243    CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
244
245    RETVALUE((*func)(&macCellCfgCfm));
246 }