Ejemplo n.º 1
0
/*****************************************************************************
  PROCEDURE NAME : eds_stop_tmr

  DESCRIPTION    : Stops the EDS timer.

  ARGUMENTS      : tmr    - ptr to the EDS timer block
               
  RETURNS        : void

  NOTES          : None
*****************************************************************************/
void eds_stop_tmr(EDS_TMR *tmr)
{
	/* If timer type is invalid just return */
	if (tmr == NULL) {
		m_LOG_EDSV_S(EDS_TIMER_STOP_FAIL, NCSFL_LC_EDSV_INIT, NCSFL_SEV_ERROR, 0, __FILE__, __LINE__, 0);
		return;
	} else if (EDS_TMR_MAX <= tmr->type) {
		m_LOG_EDSV_S(EDS_TIMER_STOP_FAIL, NCSFL_LC_EDSV_INIT, NCSFL_SEV_ERROR, tmr->type, __FILE__, __LINE__,
			     0);
		return;
	}

	/* Stop the timer if it is active... */
	if (tmr->is_active == TRUE) {
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = FALSE;
	}

	/* Destroy the timer if it exists.. */
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}

	return;
}
Ejemplo n.º 2
0
/*****************************************************************************
  PROCEDURE NAME : eds_stop_tmr

  DESCRIPTION    : Stops the EDS timer.

  ARGUMENTS      : tmr    - ptr to the EDS timer block
               
  RETURNS        : void

  NOTES          : None
*****************************************************************************/
void eds_stop_tmr(EDS_TMR *tmr)
{
	/* If timer type is invalid just return */
	if (tmr == NULL) {
		TRACE_4("timer is NULL");
		TRACE_LEAVE();
		return;
	} else if (EDS_TMR_MAX <= tmr->type) {
		TRACE_4("unsupported timer type");
		TRACE_LEAVE();
		return;
	}

	/* Stop the timer if it is active... */
	if (tmr->is_active == true) {
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = false;
	}

	/* Destroy the timer if it exists.. */
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}

	return;
}
Ejemplo n.º 3
0
/*****************************************************************************
  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;
}
Ejemplo n.º 4
0
/*****************************************************************************
  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;
}
Ejemplo n.º 5
0
/*****************************************************************************
  PROCEDURE NAME : gld_stop_tmr

  DESCRIPTION    : Stops the GLD timer.

  ARGUMENTS      : tmr    - ptr to the GLD timer block
               
  RETURNS        : void

  NOTES         : None
*****************************************************************************/
void gld_stop_tmr(GLD_TMR *tmr)
{
	/* If timer type is invalid just return */
	if (tmr == NULL) {
		m_LOG_GLD_TIMER(GLD_TIMER_STOP_FAIL, 0, __FILE__, __LINE__);
		return;
	}
	if (tmr != NULL && GLD_TMR_MAX <= tmr->type) {
		m_LOG_GLD_TIMER(GLD_TIMER_STOP_FAIL, tmr->type, __FILE__, __LINE__);
		return;
	}

	/* Stop the timer if it is active... */
	if (tmr->is_active == TRUE) {
		TRACE("Stopped GLD Timer for %d", tmr->type);
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = FALSE;
	}

	/* Destroy the timer if it exists.. */
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
	return;
}
Ejemplo n.º 6
0
/***************************************************************************** 
                                                                              
  PROCEDURE          :    ncs_exc_mdl_stop_timer                                          
                                                                               
  DESCRIPTION:       This function is used to stop a timer 
                                                                               
  ARGUMENTS:                                                                   
                                                                               
  RETURNS:           Nothing.                                                 
                                                                               
  NOTES:                                                                
                                                                               
*****************************************************************************/
void ncs_exc_mdl_stop_timer(SYSF_PID_LIST *exec_pid)
{
	m_NCS_TMR_STOP(exec_pid->tmr_id);

	m_NCS_TMR_DESTROY(exec_pid->tmr_id);
	exec_pid->tmr_id = NULL;

}
Ejemplo n.º 7
0
/****************************************************************************
 * Name          : mqd_tmr_stop
 *
 * Description   : This function which is used to stop the MQD Timer
 *
 * Arguments     : tmr      - Timer needs to be stoped.
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void mqd_tmr_stop(MQD_TMR *tmr)
{
	m_LOG_MQSV_D(MQD_TMR_STOPPED, NCSFL_LC_TIMER, NCSFL_SEV_NOTICE, 1, __FILE__, __LINE__);
	if (tmr->is_active == TRUE) {
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = FALSE;
	}
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
	return;
}
Ejemplo n.º 8
0
/****************************************************************************
 * Name          : mqd_tmr_stop
 *
 * Description   : This function which is used to stop the MQD Timer
 *
 * Arguments     : tmr      - Timer needs to be stoped.
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void mqd_tmr_stop(MQD_TMR *tmr)
{
	TRACE_1("The timer stopped");
	if (tmr->is_active == true) {
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = false;
	}
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
	return;
}
Ejemplo n.º 9
0
/****************************************************************************
 * Name          : cpd_tmr_stop
 *
 * Description   : This function which is used to stop the CPD Timer
 *
 * Arguments     : tmr      - Timer needs to be stoped.
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void cpd_tmr_stop(CPD_TMR *tmr)
{
	if (tmr->is_active == true) {
		tmr->is_active = false;
		m_NCS_TMR_STOP(tmr->tmr_id);

	}
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
	return;
}
Ejemplo n.º 10
0
/****************************************************************************
 * 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);
}
Ejemplo n.º 11
0
/***************************************************************************** 
                                                                              
  PROCEDURE          :    ncs_mbcsv_stop_timer                                          
                                                                               
  DESCRIPTION:       This function is used to stop a NCS_MBCSV timer 
                                                                               
  ARGUMENTS:                                                                   
                                                                               
  RETURNS:           Nothing.                                                 
                                                                               
  NOTES:                                                                
                                                                               
*****************************************************************************/
void ncs_mbcsv_stop_timer(PEER_INST *peer, uint32_t timer_type)
{
	NCS_MBCSV_TMR *tmr;

	if (timer_type >= NCS_MBCSV_MAX_TMRS) {
		TRACE_LEAVE2("Timer type out of range: %u", timer_type);
		return;
	}
	tmr = &peer->tmr[timer_type];

	/* Stop and destroy the timer if it is active... */

	tmr->has_expired = false;	/* if in transit, not valid now */

	if (tmr->is_active == true) {
	TRACE("stop and destroying 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_STOP(tmr->tmr_id);
		tmr->is_active = false;
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	} else if (tmr->tmr_id != TMR_T_NULL) {
		/* Destroy the timer if it exists... */
		TRACE("Destroying 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_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
}
Ejemplo n.º 12
0
/*****************************************************************************
  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;
}