2005-04-21 16:53:53 +02:00
|
|
|
#include "timers.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* tmrs_clrtimer *
|
|
|
|
*===========================================================================*/
|
2005-07-20 17:33:54 +02:00
|
|
|
clock_t tmrs_clrtimer(tmrs, tp, next_time)
|
2005-04-21 16:53:53 +02:00
|
|
|
timer_t **tmrs; /* pointer to timers queue */
|
|
|
|
timer_t *tp; /* timer to be removed */
|
2005-07-20 17:33:54 +02:00
|
|
|
clock_t *next_time;
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
/* Deactivate a timer and remove it from the timers queue.
|
|
|
|
*/
|
|
|
|
timer_t **atp;
|
2005-07-20 17:33:54 +02:00
|
|
|
clock_t prev_time;
|
2005-06-17 15:47:29 +02:00
|
|
|
|
|
|
|
if(*tmrs)
|
2005-07-20 17:33:54 +02:00
|
|
|
prev_time = (*tmrs)->tmr_exp_time;
|
2005-06-17 15:47:29 +02:00
|
|
|
else
|
2005-07-20 17:33:54 +02:00
|
|
|
prev_time = 0;
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
tp->tmr_exp_time = TMR_NEVER;
|
|
|
|
|
|
|
|
for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) {
|
|
|
|
if (*atp == tp) {
|
|
|
|
*atp = tp->tmr_next;
|
2005-06-17 15:47:29 +02:00
|
|
|
break;
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
}
|
2005-06-17 15:47:29 +02:00
|
|
|
|
2005-07-20 17:33:54 +02:00
|
|
|
if(next_time) {
|
2005-06-17 15:47:29 +02:00
|
|
|
if(*tmrs)
|
2005-07-20 17:33:54 +02:00
|
|
|
*next_time = (*tmrs)->tmr_exp_time;
|
2005-06-17 15:47:29 +02:00
|
|
|
else
|
2005-07-20 17:33:54 +02:00
|
|
|
*next_time = 0;
|
2005-06-17 15:47:29 +02:00
|
|
|
}
|
|
|
|
|
2005-07-20 17:33:54 +02:00
|
|
|
return prev_time;
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|