From ee68988518f8aa2b7cdafc2bcfe0abe6ad7df385 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Tue, 14 Jun 2011 23:59:42 +0000 Subject: change the RT_DEBUG_NOT_REENT to RT_DEBUG_NOT_IN_INTERRUPT. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1503 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/timer.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/timer.c') diff --git a/src/timer.c b/src/timer.c index 1c7803b85d..b2e1c1e13a 100644 --- a/src/timer.c +++ b/src/timer.c @@ -210,9 +210,7 @@ rt_err_t rt_timer_start(rt_timer_t timer) RT_ASSERT(timer != RT_NULL); if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED) return -RT_ERROR; -#ifdef RT_USING_HOOK - RT_OBJECT_HOOK_CALL2(rt_object_take_hook,&(timer->parent)); -#endif + RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(timer->parent))); /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -277,9 +275,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer) RT_ASSERT(timer != RT_NULL); if(!(timer->parent.flag & RT_TIMER_FLAG_ACTIVATED)) return -RT_ERROR; -#ifdef RT_USING_HOOK - RT_OBJECT_HOOK_CALL2(rt_object_put_hook,&(timer->parent)); -#endif + RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(timer->parent))); /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -364,22 +360,14 @@ void rt_timer_check(void) */ if ((current_tick - t->timeout_tick) < RT_TICK_MAX/2) { -#ifdef RT_USING_HOOK - RT_OBJECT_HOOK_CALL2(rt_timer_timeout_hook,t); -#endif + RT_OBJECT_HOOK_CALL(rt_timer_timeout_hook, (t)); /* remove timer from timer list firstly */ rt_list_remove(&(t->list)); - /* Timeout function called while interrupt is disabled, reentant function - is a must */ - RT_DEBUG_REENT_IN - /* call timeout function */ t->timeout_func(t->parameter); - RT_DEBUG_REENT_OUT - /* re-get tick */ current_tick = rt_tick_get(); @@ -455,9 +443,8 @@ void rt_soft_timer_check() */ if ((current_tick - t->timeout_tick) < RT_TICK_MAX/2) { -#ifdef RT_USING_HOOK - RT_OBJECT_HOOK_CALL2(rt_timer_timeout_hook,t); -#endif + RT_OBJECT_HOOK_CALL(rt_timer_timeout_hook, (t)); + /* move node to the next */ n = n->next; -- cgit v1.3.1