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"
25 #include "du_app_mac_inf.h"
26 #include "du_app_rlc_inf.h"
29 #include "du_mgr_main.h"
33 extern uint8_t rlcUlActvTsk (Pst *, Buffer *);
34 extern uint8_t rlcUlActvInit (Ent, Inst, Region, Reason);
35 extern uint8_t rlcDlActvTsk (Pst *, Buffer *);
36 extern uint8_t rlcDlActvInit (Ent, Inst, Region, Reason);
37 extern uint8_t rgActvTsk (Pst *, Buffer *);
38 extern uint8_t rgActvInit (Ent, Inst, Region, Reason);
41 DuCfgParams duCfgParam;
43 /*******************************************************************
45 * @brief Initializes DU APP
49 * Function : duAppInit
52 * - Registers and attaches TAPA tasks belonging to
55 * @params[in] system task ID
56 * @return ROK - success
59 * ****************************************************************/
60 uint8_t duAppInit(SSTskId sysTskId)
62 /* Register DU APP TAPA Task for DU */
63 if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
64 duActvInit, (ActvTsk)duActvTsk) != ROK)
68 /* Attach DU APP TAPA Task for DU */
69 if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
74 DU_LOG("\nDU_APP : DU APP created and registered \
75 to %d sys task", sysTskId);
79 /*******************************************************************
81 * @brief Initializes EGTP
88 * - Registers and attaches TAPA tasks belonging to
91 * @params[in] system task ID
92 * @return ROK - success
95 * ****************************************************************/
96 uint8_t egtpInit(SSTskId sysTskId)
98 /* Register DU APP TAPA Task for DU */
99 if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
100 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
104 /* Attach DU APP TAPA Task for DU */
105 if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
110 DU_LOG("\nDU_APP : EGTP created and registered \
111 to %d sys task", sysTskId);
116 /*******************************************************************
118 * @brief Initializes SCTP task
122 * Function : sctpInit
125 * - Registers and attaches TAPA tasks for SCTP receiver
127 * @params[in] system task ID
128 * @return ROK - success
131 * ****************************************************************/
132 uint8_t sctpInit(SSTskId sysTskId)
134 /* Register SCTP TAPA Task */
135 if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
136 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
140 /* Attach SCTP TAPA Task */
141 if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
146 DU_LOG("\nDU_APP : SCTP TAPA task created and registered to %d sys task",
150 /*******************************************************************
152 * @brief Initializes RLC DL, MAC TAPA task
156 * Function : rlcDlInit
159 * - Registers and attaches TAPA tasks for MAC and RLC DL
161 * @params[in] system task ID
162 * @return ROK - success
165 * ****************************************************************/
166 uint8_t rlcDlInit(SSTskId sysTskId)
168 /* Register RLC DL TAPA Task */
169 if(ODU_REG_TTSK((Ent)ENTKW, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
170 rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
174 /* Attach RLC DL Task */
175 if (ODU_ATTACH_TTSK((Ent)ENTKW, (Inst)1, sysTskId)!= ROK)
180 /* Register MAC TAPA Task */
181 if(ODU_REG_TTSK((Ent)ENTRG, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
182 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
186 /* Attach MAC Task */
187 if (ODU_ATTACH_TTSK((Ent)ENTRG, (Inst)0, sysTskId)!= ROK)
192 DU_LOG("\nDU_APP : RLC DL and MAC TAPA task created and registered to \
193 %d sys task", sysTskId);
197 /*******************************************************************
199 * @brief Initializes RLC UL TAPA task
203 * Function : rlcUlInit
206 * - Registers and attaches TAPA task for RLC UL
208 * @params[in] system task ID
209 * @return ROK - success
212 * ****************************************************************/
213 uint8_t rlcUlInit(SSTskId sysTskId)
215 /* Register RLC UL TAPA Task */
216 if(ODU_REG_TTSK((Ent)ENTKW, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
217 rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
221 /* Attach RLC DL Task */
222 if (ODU_ATTACH_TTSK((Ent)ENTKW, (Inst)0, sysTskId)!= ROK)
226 DU_LOG("\nDU_APP : RLC UL TAPA task created and registered to \
227 %d sys task", sysTskId);
231 /*******************************************************************
233 * @brief Initializes system and TAPA tasks
237 * Function : commonInit
240 * - Registers and attaches system and TAPA tasks
243 * @return ROK - success
246 * ****************************************************************/
249 /* Declare system task Ids */
250 SSTskId du_app_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk;
254 ODU_SET_PROC_ID(DU_PROC);
256 /* system task for DU APP */
257 SCreateSTsk(PRIOR0, &du_app_stsk);
259 /* system task for RLC_DL and MAC */
260 SCreateSTsk(PRIOR0, &rlc_mac_cl_stsk);
261 pthread_attr_init(&attr);
262 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
264 /* system task for RLC UL */
265 SCreateSTsk(PRIOR1, &rlc_ul_stsk);
267 /* system task for SCTP receiver thread */
268 SCreateSTsk(PRIOR0, &sctp_stsk);
270 /* Create TAPA tasks */
271 if(duAppInit(du_app_stsk) != ROK)
273 DU_LOG("\nDU_APP : DU APP TAPA Task initialization failed");
277 if(egtpInit(du_app_stsk) != ROK)
279 DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed");
283 if(sctpInit(sctp_stsk) != ROK)
285 DU_LOG("\nDU_APP : SCTP TAPA Task initialization failed");
289 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
291 DU_LOG("\nDU_APP : RLC DL Tapa Task initialization failed");
295 if(rlcUlInit(rlc_ul_stsk) != ROK)
297 DU_LOG("\nDU_APP : RLC UL Tapa Task initialization failed");
303 /*******************************************************************
305 * @brief Initializes the DU
313 * - Registers DU Layers
316 * @return ROK - success
319 * ****************************************************************/
323 if(commonInit() != ROK)
333 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
335 /*******************************************************************
337 * @brief Entry point for the DU APP
344 * - Read config params into duCfgParams
345 * - Initiate the init functions
348 * @return ROK - success
351 * ****************************************************************/
356 //Initialize TAPA layers
363 //Read all the configs from du_utils.c into duCfgParams
369 /**********************************************************************
371 **********************************************************************/