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 "common_def.h"
25 #include "du_app_rlc_inf.h"
26 #include "du_app_mac_inf.h"
28 #include "du_e2ap_mgr.h"
30 #include "du_e2ap_msg_hdl.h"
33 * @brief Handler to check if the timer is running
35 * @param[in] cb Control block depending on the type of the timer event.
36 * It can be uplink/downlink rbCb or rgu sap control block
37 * @param[in] tmrEvnt Timer event to be started
39 * @return Bool indicating whether the timer is running or not
44 bool duChkTmr(PTR cb, int16_t tmrEvnt)
48 case EVENT_E2_SETUP_TMR:
50 if(((CmTimer *)cb)->tmrEvnt == EVENT_E2_SETUP_TMR)
52 DU_LOG("\nERROR --> DU_APP : duChkTmr: Invalid tmr Evnt [%d]", tmrEvnt);
57 case EVENT_RIC_SERVICE_UPDATE_TMR:
59 if(((RicServiceUpdateTimer*)cb)->timer.tmrEvnt == EVENT_RIC_SERVICE_UPDATE_TMR)
61 DU_LOG("\nERROR --> DU_APP : duChkTmr: Timer already running for event [%d]", tmrEvnt);
66 case EVENT_E2_NODE_CONFIG_UPDATE_TMR:
68 if(((E2NodeConfigUpdateTimer *)cb)->timer.tmrEvnt == EVENT_E2_NODE_CONFIG_UPDATE_TMR)
70 DU_LOG("\nERROR --> DU_APP : duChkTmr: Invalid tmr Evnt [%d]", tmrEvnt);
77 DU_LOG("\nERROR --> DU_APP : duChkTmr: Invalid tmr Evnt [%d]", tmrEvnt);
85 * @brief Handler to start timer
87 * @param[in] cb Control block depending on the type of the timer event.
88 * It can be uplink/downlink rbCb or rgu sap control block
89 * @param[in] tmrEvnt Timer event to be started
94 void duStartTmr(PTR cb, int16_t tmrEvnt, uint8_t timerValue)
101 case EVENT_E2_SETUP_TMR:
103 CmTimer *e2SetupTimer;
104 e2SetupTimer = ((CmTimer *)cb);
105 TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes);
107 arg.timers = e2SetupTimer;
108 arg.max = MAX_E2_SETUP_TMR;
111 case EVENT_RIC_SERVICE_UPDATE_TMR:
113 RicServiceUpdateTimer *ricServiceUpdateTimer;
114 ricServiceUpdateTimer= ((RicServiceUpdateTimer*)cb);
115 TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes);
117 arg.timers = &ricServiceUpdateTimer->timer;
118 arg.max = MAX_RIC_SERVICE_UPDATE_TMR;
121 case EVENT_E2_NODE_CONFIG_UPDATE_TMR:
123 E2NodeConfigUpdateTimer *cfgUpdateTimer;
124 cfgUpdateTimer = ((E2NodeConfigUpdateTimer*)cb);
125 TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes);
127 arg.timers = &cfgUpdateTimer->timer;
128 arg.max = MAX_E2_NODE_CONFIG_UPDATE_TMR;
133 DU_LOG("\nERROR --> DU : duStartTmr: Invalid tmr Evnt [%d]", tmrEvnt);
139 arg.tqCp = &(duCb.duTimersInfo.tmrTqCp);
140 arg.tq = duCb.duTimersInfo.tmrTq;
151 * @brief Handler to invoke events on expiry of timer.
154 * This function is used to handle expiry of timer,it invokes relevant
157 * @param[in] cb Control block depending on the type of the timer event.
158 * It can be uplink/downlink rbCb or rgu sap control block
159 * @param[in] tmrEvnt Timer event to be started
164 void duTmrExpiry(PTR cb,int16_t tmrEvnt)
168 case EVENT_E2_SETUP_TMR:
170 BuildAndSendE2SetupReq();
173 case EVENT_RIC_SERVICE_UPDATE_TMR:
175 RicServiceUpdateTimer *ricServiceUpdateTimer;
177 ricServiceUpdateTimer= ((RicServiceUpdateTimer*)cb);
178 BuildAndSendRicServiceUpdate(ricServiceUpdateTimer->ricService);
181 case EVENT_E2_NODE_CONFIG_UPDATE_TMR:
183 E2NodeConfigUpdateTimer *cfgUpdateTimer;
185 cfgUpdateTimer = ((E2NodeConfigUpdateTimer*)cb);
186 BuildAndSendE2NodeConfigUpdate(&cfgUpdateTimer->configList);
191 DU_LOG("\nERROR --> DU : duStartTmr: Invalid tmr Evnt [%d]", tmrEvnt);
200 * @brief DU instance timer call back function registered with system services.
204 * Function : duActvTmr
206 * This function is invoked for every timer activation
207 * period expiry. Note that SS_MT_TMR flag needs to be enabled for this
208 * as isntId is needed.As part of SRegTmr call for du instance
209 * SS_MT_TMR flag needs to be enabled and duActvTmr needs to be given as
216 short int duActvTmr(Ent ent,Inst inst)
218 /* Check if any timer in the du instance has expired */
219 cmPrcTmr(&(duCb.duTimersInfo.tmrTqCp), duCb.duTimersInfo.tmrTq, (PFV) duTmrExpiry);
223 } /* end of duActvTmr */
225 /**********************************************************************
228 **********************************************************************/