/* Stop counting the timer instance. 
If there are no more timer instance started it also stops the hardware timer.  */
int32_t timer_stop(struct timer_desc *desc)
/* Stop counting the timer instance. 
If there are no more timer instance started it also stops the hardware timer.  */
int32_t timer_stop(struct timer_desc *desc)
{
	uint32_t		counter;
	struct aducm_timer_desc *tmr_desc;
	if (!desc)
		return FAILURE;
	tmr_desc = desc->extra;
	if (!tmr_desc->started)
		return FAILURE;
	timer_counter_get(desc, &counter);
	desc->load_value = counter;
	if (nb_enables == 1)
		while (ADI_TMR_DEVICE_BUSY == adi_tmr_Enable(timer_id, false));
	nb_enables--;
	tmr_desc->started = false;
	return SUCCESS;
}