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);
56 case EVENT_RIC_SERVICE_UPDATE_TMR:
58 if(((RicServiceUpdateTimer*)cb)->timer.tmrEvnt == EVENT_RIC_SERVICE_UPDATE_TMR)
60 DU_LOG("\nERROR --> DU_APP : duChkTmr: Timer already running for event [%d]", tmrEvnt);
67 DU_LOG("\nERROR --> DU_APP : duChkTmr: Invalid tmr Evnt [%d]", tmrEvnt);
75 * @brief Handler to start timer
77 * @param[in] cb Control block depending on the type of the timer event.
78 * It can be uplink/downlink rbCb or rgu sap control block
79 * @param[in] tmrEvnt Timer event to be started
84 void duStartTmr(PTR cb, int16_t tmrEvnt, uint8_t timerValue)
91 case EVENT_E2_SETUP_TMR:
93 CmTimer *e2SetupTimer;
94 e2SetupTimer = ((CmTimer *)cb);
95 TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes);
97 arg.timers = e2SetupTimer;
98 arg.max = MAX_E2_SETUP_TMR;
101 case EVENT_RIC_SERVICE_UPDATE_TMR:
103 RicServiceUpdateTimer *ricServiceUpdateTimer;
104 ricServiceUpdateTimer= ((RicServiceUpdateTimer*)cb);
105 TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes);
107 arg.timers = &ricServiceUpdateTimer->timer;
108 arg.max = MAX_RIC_SERVICE_UPDATE_TMR;
113 DU_LOG("\nERROR --> DU : duStartTmr: Invalid tmr Evnt [%d]", tmrEvnt);
119 arg.tqCp = &(duCb.duTimersInfo.tmrTqCp);
120 arg.tq = duCb.duTimersInfo.tmrTq;
131 * @brief Handler to invoke events on expiry of timer.
134 * This function is used to handle expiry of timer,it invokes relevant
137 * @param[in] cb Control block depending on the type of the timer event.
138 * It can be uplink/downlink rbCb or rgu sap control block
139 * @param[in] tmrEvnt Timer event to be started
144 void duTmrExpiry(PTR cb,int16_t tmrEvnt)
148 case EVENT_E2_SETUP_TMR:
150 BuildAndSendE2SetupReq();
153 case EVENT_RIC_SERVICE_UPDATE_TMR:
155 RicServiceUpdateTimer *ricServiceUpdateTimer;
157 ricServiceUpdateTimer= ((RicServiceUpdateTimer*)cb);
158 BuildAndSendRicServiceUpdate(ricServiceUpdateTimer->ricService);
163 DU_LOG("\nERROR --> DU : duStartTmr: Invalid tmr Evnt [%d]", tmrEvnt);
172 * @brief DU instance timer call back function registered with system services.
176 * Function : duActvTmr
178 * This function is invoked for every timer activation
179 * period expiry. Note that SS_MT_TMR flag needs to be enabled for this
180 * as isntId is needed.As part of SRegTmr call for du instance
181 * SS_MT_TMR flag needs to be enabled and duActvTmr needs to be given as
188 short int duActvTmr(Ent ent,Inst inst)
190 /* Check if any timer in the du instance has expired */
191 cmPrcTmr(&(duCb.duTimersInfo.tmrTqCp), duCb.duTimersInfo.tmrTq, (PFV) duTmrExpiry);
195 } /* end of duActvTmr */
197 /**********************************************************************
200 **********************************************************************/