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 /* This file is the entry point for DU APP */
21 #include "du_mgr_main.h"
26 extern S16 kwUlActvTsk (Pst *, Buffer *);
27 extern S16 kwUlActvInit (Ent, Inst, Region, Reason);
28 extern S16 kwDlActvTsk (Pst *, Buffer *);
29 extern S16 kwDlActvInit (Ent, Inst, Region, Reason);
30 extern S16 rgActvTsk (Pst *, Buffer *);
31 extern S16 rgActvInit (Ent, Inst, Region, Reason);
34 DuCfgParams duCfgParam;
36 /*******************************************************************
38 * @brief Initializes DU APP
42 * Function : duAppInit
45 * - Registers and attaches TAPA tasks belonging to
48 * @params[in] system task ID
49 * @return ROK - success
52 * ****************************************************************/
53 S16 duAppInit(SSTskId sysTskId)
55 /* Register DU APP TAPA Task for DU */
56 if(SRegTTsk((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
57 duActvInit, (ActvTsk)duActvTsk) != ROK)
61 /* Attach DU APP TAPA Task for DU */
62 if (SAttachTTsk((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
67 DU_LOG("\nDU_APP : DU APP created and registered \
68 to %d sys task", sysTskId);
72 /*******************************************************************
74 * @brief Initializes EGTP
81 * - Registers and attaches TAPA tasks belonging to
84 * @params[in] system task ID
85 * @return ROK - success
88 * ****************************************************************/
89 S16 egtpInit(SSTskId sysTskId)
91 /* Register DU APP TAPA Task for DU */
92 if(SRegTTsk((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
93 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
97 /* Attach DU APP TAPA Task for DU */
98 if (SAttachTTsk((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
103 DU_LOG("\nDU_APP : EGTP created and registered \
104 to %d sys task", sysTskId);
109 /*******************************************************************
111 * @brief Initializes SCTP task
115 * Function : sctpInit
118 * - Registers and attaches TAPA tasks for SCTP receiver
120 * @params[in] system task ID
121 * @return ROK - success
124 * ****************************************************************/
125 S16 sctpInit(SSTskId sysTskId)
127 /* Register SCTP TAPA Task */
128 if(SRegTTsk((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
129 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
133 /* Attach SCTP TAPA Task */
134 if (SAttachTTsk((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
139 DU_LOG("\nDU_APP : SCTP TAPA task created and registered to %d sys task",
143 /*******************************************************************
145 * @brief Initializes RLC DL, MAC TAPA task
149 * Function : rlcDlInit
152 * - Registers and attaches TAPA tasks for MAC and RLC DL
154 * @params[in] system task ID
155 * @return ROK - success
158 * ****************************************************************/
159 S16 rlcDlInit(SSTskId sysTskId)
161 /* Register RLC DL TAPA Task */
162 if(SRegTTsk((Ent)ENTKW, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
163 kwDlActvInit, (ActvTsk)kwDlActvTsk) != ROK)
167 /* Attach RLC DL Task */
168 if (SAttachTTsk((Ent)ENTKW, (Inst)1, sysTskId)!= ROK)
173 /* Register MAC TAPA Task */
174 if(SRegTTsk((Ent)ENTRG, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
175 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
179 /* Attach MAC Task */
180 if (SAttachTTsk((Ent)ENTRG, (Inst)0, sysTskId)!= ROK)
185 DU_LOG("\nDU_APP : RLC DL and MAC TAPA task created and registered to \
186 %d sys task", sysTskId);
190 /*******************************************************************
192 * @brief Initializes RLC UL TAPA task
196 * Function : rlcUlInit
199 * - Registers and attaches TAPA task for RLC UL
201 * @params[in] system task ID
202 * @return ROK - success
205 * ****************************************************************/
206 S16 rlcUlInit(SSTskId sysTskId)
208 /* Register RLC UL TAPA Task */
209 if(SRegTTsk((Ent)ENTKW, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
210 kwUlActvInit, (ActvTsk)kwUlActvTsk) != ROK)
214 /* Attach RLC DL Task */
215 if (SAttachTTsk((Ent)ENTKW, (Inst)0, sysTskId)!= ROK)
219 DU_LOG("\nDU_APP : RLC UL TAPA task created and registered to \
220 %d sys task", sysTskId);
224 /*******************************************************************
226 * @brief Initializes system and TAPA tasks
230 * Function : commonInit
233 * - Registers and attaches system and TAPA tasks
236 * @return ROK - success
239 * ****************************************************************/
242 /* Declare system task Ids */
243 SSTskId du_app_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk;
249 /* system task for DU APP */
250 SCreateSTsk(PRIOR0, &du_app_stsk);
252 /* system task for RLC_DL and MAC */
253 SCreateSTsk(PRIOR0, &rlc_mac_cl_stsk);
254 pthread_attr_init(&attr);
255 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
257 /* system task for RLC UL */
258 SCreateSTsk(PRIOR1, &rlc_ul_stsk);
260 /* system task for SCTP receiver thread */
261 SCreateSTsk(PRIOR0, &sctp_stsk);
263 /* Create TAPA tasks */
264 if(duAppInit(du_app_stsk) != ROK)
266 DU_LOG("\nDU_APP : DU APP TAPA Task initialization failed");
270 if(egtpInit(du_app_stsk) != ROK)
272 DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed");
276 if(sctpInit(sctp_stsk) != ROK)
278 DU_LOG("\nDU_APP : SCTP TAPA Task initialization failed");
282 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
284 DU_LOG("\nDU_APP : RLC DL Tapa Task initialization failed");
288 if(rlcUlInit(rlc_ul_stsk) != ROK)
290 DU_LOG("\nDU_APP : RLC UL Tapa Task initialization failed");
296 /*******************************************************************
298 * @brief Initializes the DU
306 * - Registers DU Layers
309 * @return ROK - success
312 * ****************************************************************/
316 if(commonInit() != ROK)
326 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
328 /*******************************************************************
330 * @brief Entry point for the DU APP
337 * - Read config params into duCfgParams
338 * - Initiate the init functions
341 * @return ROK - success
344 * ****************************************************************/
349 //Initialize TAPA layers
356 //Read all the configs from du_utils.c into duCfgParams
362 /**********************************************************************
364 **********************************************************************/