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 */
20 #include "common_def.h"
26 #include "du_mgr_main.h"
31 extern S16 kwUlActvTsk (Pst *, Buffer *);
32 extern S16 kwUlActvInit (Ent, Inst, Region, Reason);
33 extern S16 kwDlActvTsk (Pst *, Buffer *);
34 extern S16 kwDlActvInit (Ent, Inst, Region, Reason);
35 extern S16 rgActvTsk (Pst *, Buffer *);
36 extern S16 rgActvInit (Ent, Inst, Region, Reason);
39 DuCfgParams duCfgParam;
41 /*******************************************************************
43 * @brief Initializes DU APP
47 * Function : duAppInit
50 * - Registers and attaches TAPA tasks belonging to
53 * @params[in] system task ID
54 * @return ROK - success
57 * ****************************************************************/
58 S16 duAppInit(SSTskId sysTskId)
60 /* Register DU APP TAPA Task for DU */
61 if(SRegTTsk((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
62 duActvInit, (ActvTsk)duActvTsk) != ROK)
66 /* Attach DU APP TAPA Task for DU */
67 if (SAttachTTsk((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
72 DU_LOG("\nDU_APP : DU APP created and registered \
73 to %d sys task", sysTskId);
77 /*******************************************************************
79 * @brief Initializes EGTP
86 * - Registers and attaches TAPA tasks belonging to
89 * @params[in] system task ID
90 * @return ROK - success
93 * ****************************************************************/
94 S16 egtpInit(SSTskId sysTskId)
96 /* Register DU APP TAPA Task for DU */
97 if(SRegTTsk((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
98 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
102 /* Attach DU APP TAPA Task for DU */
103 if (SAttachTTsk((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
108 DU_LOG("\nDU_APP : EGTP created and registered \
109 to %d sys task", sysTskId);
114 /*******************************************************************
116 * @brief Initializes SCTP task
120 * Function : sctpInit
123 * - Registers and attaches TAPA tasks for SCTP receiver
125 * @params[in] system task ID
126 * @return ROK - success
129 * ****************************************************************/
130 S16 sctpInit(SSTskId sysTskId)
132 /* Register SCTP TAPA Task */
133 if(SRegTTsk((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
134 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
138 /* Attach SCTP TAPA Task */
139 if (SAttachTTsk((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
144 DU_LOG("\nDU_APP : SCTP TAPA task created and registered to %d sys task",
148 /*******************************************************************
150 * @brief Initializes RLC DL, MAC TAPA task
154 * Function : rlcDlInit
157 * - Registers and attaches TAPA tasks for MAC and RLC DL
159 * @params[in] system task ID
160 * @return ROK - success
163 * ****************************************************************/
164 S16 rlcDlInit(SSTskId sysTskId)
166 /* Register RLC DL TAPA Task */
167 if(SRegTTsk((Ent)ENTKW, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
168 kwDlActvInit, (ActvTsk)kwDlActvTsk) != ROK)
172 /* Attach RLC DL Task */
173 if (SAttachTTsk((Ent)ENTKW, (Inst)1, sysTskId)!= ROK)
178 /* Register MAC TAPA Task */
179 if(SRegTTsk((Ent)ENTRG, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
180 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
184 /* Attach MAC Task */
185 if (SAttachTTsk((Ent)ENTRG, (Inst)0, sysTskId)!= ROK)
190 DU_LOG("\nDU_APP : RLC DL and MAC TAPA task created and registered to \
191 %d sys task", sysTskId);
195 /*******************************************************************
197 * @brief Initializes RLC UL TAPA task
201 * Function : rlcUlInit
204 * - Registers and attaches TAPA task for RLC UL
206 * @params[in] system task ID
207 * @return ROK - success
210 * ****************************************************************/
211 S16 rlcUlInit(SSTskId sysTskId)
213 /* Register RLC UL TAPA Task */
214 if(SRegTTsk((Ent)ENTKW, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
215 kwUlActvInit, (ActvTsk)kwUlActvTsk) != ROK)
219 /* Attach RLC DL Task */
220 if (SAttachTTsk((Ent)ENTKW, (Inst)0, sysTskId)!= ROK)
224 DU_LOG("\nDU_APP : RLC UL TAPA task created and registered to \
225 %d sys task", sysTskId);
229 /*******************************************************************
231 * @brief Initializes system and TAPA tasks
235 * Function : commonInit
238 * - Registers and attaches system and TAPA tasks
241 * @return ROK - success
244 * ****************************************************************/
247 /* Declare system task Ids */
248 SSTskId du_app_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk;
254 /* system task for DU APP */
255 SCreateSTsk(PRIOR0, &du_app_stsk);
257 /* system task for RLC_DL and MAC */
258 SCreateSTsk(PRIOR0, &rlc_mac_cl_stsk);
259 pthread_attr_init(&attr);
260 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
262 /* system task for RLC UL */
263 SCreateSTsk(PRIOR1, &rlc_ul_stsk);
265 /* system task for SCTP receiver thread */
266 SCreateSTsk(PRIOR0, &sctp_stsk);
268 /* Create TAPA tasks */
269 if(duAppInit(du_app_stsk) != ROK)
271 DU_LOG("\nDU_APP : DU APP TAPA Task initialization failed");
275 if(egtpInit(du_app_stsk) != ROK)
277 DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed");
281 if(sctpInit(sctp_stsk) != ROK)
283 DU_LOG("\nDU_APP : SCTP TAPA Task initialization failed");
287 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
289 DU_LOG("\nDU_APP : RLC DL Tapa Task initialization failed");
293 if(rlcUlInit(rlc_ul_stsk) != ROK)
295 DU_LOG("\nDU_APP : RLC UL Tapa Task initialization failed");
301 /*******************************************************************
303 * @brief Initializes the DU
311 * - Registers DU Layers
314 * @return ROK - success
317 * ****************************************************************/
321 if(commonInit() != ROK)
331 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
333 /*******************************************************************
335 * @brief Entry point for the DU APP
342 * - Read config params into duCfgParams
343 * - Initiate the init functions
346 * @return ROK - success
349 * ****************************************************************/
354 //Initialize TAPA layers
361 //Read all the configs from du_utils.c into duCfgParams
367 /**********************************************************************
369 **********************************************************************/