/**************************************************************************** * Name : cpd_tmr_start * * Description : This function which is used to start the CPD Timer * *****************************************************************************/ uint32_t cpd_tmr_start(CPD_TMR *tmr, uint32_t duration) { if (tmr->tmr_id == TMR_T_NULL) { m_NCS_TMR_CREATE(tmr->tmr_id, duration, cpd_timer_expiry, (void *)tmr); } if (tmr->is_active == false) { m_NCS_TMR_START(tmr->tmr_id, (uint32_t)duration, cpd_timer_expiry, (void *)tmr); tmr->is_active = true; } else { m_NCS_TMR_STOP(tmr->tmr_id); m_NCS_TMR_START(tmr->tmr_id, (uint32_t)duration, cpd_timer_expiry, (void *)tmr); } return (NCSCC_RC_SUCCESS); }
/***************************************************************************** PROCEDURE NAME : eds_start_tmr DESCRIPTION : Starts the EDS timer. If the timer is already active, it is restarted (ie. stopped & started without reallocating the tmr block). ARGUMENTS : cb - ptr to the EDS control block tmr - ptr to the EDS timer block type - timer type period - timer period uarg - opaque handle that is returned on timer expiry RETURNS : NCSCC_RC_SUCCESS - Success NCSCC_RC_FAILURE - Failure NOTES : None *****************************************************************************/ uns32 eds_start_tmr(EDS_CB *cb, EDS_TMR *tmr, EDS_TMR_TYPE type, SaTimeT period, uns32 uarg) { uns32 tmr_period = (uns32)(period / EDSV_NANOSEC_TO_LEAPTM); if (EDS_TMR_MAX <= tmr->type) { m_LOG_EDSV_S(EDS_TIMER_START_FAIL, NCSFL_LC_EDSV_INIT, NCSFL_SEV_ERROR, type, __FILE__, __LINE__, tmr_period); return NCSCC_RC_FAILURE; } if (tmr->tmr_id == TMR_T_NULL) { tmr->type = type; m_NCS_TMR_CREATE(tmr->tmr_id, (uns32)tmr_period, eds_tmr_exp, (void *)tmr); } if (tmr->is_active == TRUE) { m_NCS_TMR_STOP(tmr->tmr_id); tmr->is_active = FALSE; } tmr->opq_hdl = uarg; tmr->cb_hdl = cb->my_hdl; m_NCS_TMR_START(tmr->tmr_id, (uns32)tmr_period, eds_tmr_exp, (void *)tmr); tmr->is_active = TRUE; if (TMR_T_NULL == tmr->tmr_id) { m_LOG_EDSV_S(EDS_TIMER_START_FAIL, NCSFL_LC_EDSV_INIT, NCSFL_SEV_ERROR, type, __FILE__, __LINE__, tmr_period); return NCSCC_RC_FAILURE; } return NCSCC_RC_SUCCESS; }
/***************************************************************************** PROCEDURE NAME : eds_start_tmr DESCRIPTION : Starts the EDS timer. If the timer is already active, it is restarted (ie. stopped & started without reallocating the tmr block). ARGUMENTS : cb - ptr to the EDS control block tmr - ptr to the EDS timer block type - timer type period - timer period uarg - opaque handle that is returned on timer expiry RETURNS : NCSCC_RC_SUCCESS - Success NCSCC_RC_FAILURE - Failure NOTES : None *****************************************************************************/ uint32_t eds_start_tmr(EDS_CB *cb, EDS_TMR *tmr, EDS_TMR_TYPE type, SaTimeT period, uint32_t uarg) { uint32_t tmr_period = (uint32_t)(period / EDSV_NANOSEC_TO_LEAPTM); if (EDS_TMR_MAX <= tmr->type) { LOG_WA("Unsupported timer type"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } if (tmr->tmr_id == TMR_T_NULL) { tmr->type = type; m_NCS_TMR_CREATE(tmr->tmr_id, (uint32_t)tmr_period, eds_tmr_exp, (void *)tmr); } if (tmr->is_active == true) { m_NCS_TMR_STOP(tmr->tmr_id); tmr->is_active = false; } tmr->opq_hdl = uarg; tmr->cb_hdl = cb->my_hdl; m_NCS_TMR_START(tmr->tmr_id, (uint32_t)tmr_period, eds_tmr_exp, (void *)tmr); tmr->is_active = true; if (TMR_T_NULL == tmr->tmr_id) { LOG_NO("Timer start failed: type: %u, Id: %p, period: %u", type, tmr->tmr_id, tmr_period); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } TRACE_LEAVE(); return NCSCC_RC_SUCCESS; }
/***************************************************************************** PROCEDURE : ncs_exc_mdl_start_timer DESCRIPTION: This function is used to start a timer ARGUMENTS: RETURNS: Nothing. NOTES: *****************************************************************************/ void ncs_exc_mdl_start_timer(SYSF_PID_LIST *exec_pid) { /* Timer does not exist, create it. */ m_NCS_TMR_CREATE(exec_pid->tmr_id, (exec_pid->timeout_in_ms / 10), ncs_exec_module_timer_hdlr, (void *)exec_pid->pid); /* Now Start the timer. */ m_NCS_TMR_START(exec_pid->tmr_id, (exec_pid->timeout_in_ms / 10), ncs_exec_module_timer_hdlr, NCS_INT32_TO_PTR_CAST(exec_pid->pid)); }
/**************************************************************************** * Name : mqd_tmr_start * * Description : This function which is used to start the MQD Timer * *****************************************************************************/ uns32 mqd_tmr_start(MQD_TMR *tmr, SaTimeT duration) { m_LOG_MQSV_D(MQD_TMR_START, NCSFL_LC_TIMER, NCSFL_SEV_NOTICE, duration, __FILE__, __LINE__); if (tmr->tmr_id == TMR_T_NULL) { m_NCS_TMR_CREATE(tmr->tmr_id, duration, mqd_timer_expiry, (void *)tmr); } if (tmr->is_active == FALSE) { m_NCS_TMR_START(tmr->tmr_id, (uns32)duration, mqd_timer_expiry, (void *)tmr); tmr->is_active = TRUE; } return (NCSCC_RC_SUCCESS); }
/**************************************************************************** * Name : mqd_tmr_start * * Description : This function which is used to start the MQD Timer * *****************************************************************************/ uint32_t mqd_tmr_start(MQD_TMR *tmr, SaTimeT duration) { TRACE_1("The timer started with the duration as %u", (uint32_t)duration); if (tmr->tmr_id == TMR_T_NULL) { m_NCS_TMR_CREATE(tmr->tmr_id, duration, mqd_timer_expiry, (void *)tmr); } if (tmr->is_active == false) { m_NCS_TMR_START(tmr->tmr_id, (uint32_t)duration, mqd_timer_expiry, (void *)tmr); tmr->is_active = true; } return (NCSCC_RC_SUCCESS); }
/***************************************************************************** PROCEDURE : ncs_mbcsv_start_timer DESCRIPTION: This function is used to start a NCS_MBCSV timer ARGUMENTS: RETURNS: Nothing. NOTES: *****************************************************************************/ void ncs_mbcsv_start_timer(PEER_INST *peer, uint8_t timer_type) { NCS_MBCSV_TMR *tmr; TRACE_ENTER(); if (timer_type >= NCS_MBCSV_MAX_TMRS) { TRACE_LEAVE2("Timer type out of range: %u", timer_type); return; } tmr = &peer->tmr[timer_type]; tmr->xdb = (NCS_MBCSV_TMR_HDL)peer; /* If timer does not exist, create it. */ if (tmr->tmr_id == TMR_T_NULL) { TRACE("creating timer"); m_NCS_TMR_CREATE(tmr->tmr_id, tmr->period, ncs_mbcsv_tmr_db[timer_type].cb_func, (void *)tmr); } /* If timer is not active, start it. */ tmr->has_expired = false; /* if in transit, not valid now */ if (tmr->is_active == false) { tmr->type = timer_type; TRACE("starting timer. my role:%u, svc_id:%u, pwe_hdl:%u, peer_anchor: %" PRIu64 ", tmr type:%s", peer->my_ckpt_inst->my_role, peer->my_ckpt_inst->my_mbcsv_inst->svc_id, peer->my_ckpt_inst->pwe_hdl, peer->peer_anchor, tmr_type_str[timer_type]); m_NCS_TMR_START(tmr->tmr_id, tmr->period, ncs_mbcsv_tmr_db[timer_type].cb_func, (void *)tmr); tmr->is_active = true; } TRACE_LEAVE(); }
/**************************************************************************** * Name : fm_tmr_start * * Description : Starts timer with the given period * * Arguments : Pointer to TImer Data Str * * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE. * * Notes : None. *****************************************************************************/ uns32 fm_tmr_start(FM_TMR *tmr, SaTimeT period) { uns32 tmr_period; tmr_period = (uns32)period; if (tmr->tmr_id == NULL) { m_NCS_TMR_CREATE(tmr->tmr_id, tmr_period, fm_tmr_exp, (void *)tmr); } if (tmr->status == FM_TMR_RUNNING) { return NCSCC_RC_FAILURE; } m_NCS_TMR_START(tmr->tmr_id, tmr_period, fm_tmr_exp, (void *)tmr); tmr->status = FM_TMR_RUNNING; if (TMR_T_NULL == tmr->tmr_id) { return NCSCC_RC_FAILURE; } return NCSCC_RC_SUCCESS; }
/***************************************************************************** PROCEDURE NAME : gld_start_tmr DESCRIPTION : Starts the GLD timer. If the timer is already active, it is restarted (ie. stopped & started without reallocating the tmr block). ARGUMENTS : cb - ptr to the GLD control block tmr - ptr to the GLD timer block type - timer type period - timer period uarg - opaque handle that is returned on timer expiry RETURNS : NCSCC_RC_SUCCESS - Success NCSCC_RC_FAILURE - Failure NOTES : None *****************************************************************************/ uns32 gld_start_tmr(GLSV_GLD_CB *cb, GLD_TMR *tmr, GLD_TMR_TYPE type, SaTimeT period, uns32 uarg) { uns32 my_period = (uns32)(m_GLSV_CONVERT_SATIME_TEN_MILLI_SEC(period)); if (tmr == NULL) return NCSCC_RC_FAILURE; if (GLD_TMR_MAX <= type) { m_LOG_GLD_TIMER(GLD_TIMER_START_FAIL, type, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } if (tmr->tmr_id == TMR_T_NULL) { tmr->type = type; tmr->cb_hdl = cb->my_hdl; m_NCS_TMR_CREATE(tmr->tmr_id, my_period, gld_tmr_exp, (void *)tmr); } if (tmr->is_active == TRUE) { m_NCS_TMR_STOP(tmr->tmr_id); tmr->is_active = FALSE; } tmr->opq_hdl = uarg; tmr->cb_hdl = cb->my_hdl; m_NCS_TMR_START(tmr->tmr_id, my_period, gld_tmr_exp, (void *)tmr); tmr->is_active = TRUE; if (TMR_T_NULL == tmr->tmr_id) { m_LOG_GLD_TIMER(GLD_TIMER_START_FAIL, type, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } TRACE("Started GLD Timer for %d @ %d ticks", type, my_period); return NCSCC_RC_SUCCESS; }