diff options
| author | [email protected] <[email protected]> | 2010-05-22 23:26:08 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2010-05-22 23:26:08 +0000 |
| commit | 0eaf2098b86ceef04b60fdd5407ccd9a3206def0 (patch) | |
| tree | 8fd386325f6e339e39bfd3ae04e9685f1fdf84db /src/clock.c | |
| parent | b34d10449f6aa9e298a7df44c95706f858840577 (diff) | |
fix the timer check bug.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@730 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/clock.c')
| -rw-r--r-- | src/clock.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/clock.c b/src/clock.c index 4f785dd5b9..6ca918d1f8 100644 --- a/src/clock.c +++ b/src/clock.c @@ -11,8 +11,9 @@ * Date Author Notes * 2006-03-12 Bernard first version * 2006-05-27 Bernard add support for same priority thread schedule - * 2006-08-10 Bernard remove the last rt_schedule in rt_tick_increase
+ * 2006-08-10 Bernard remove the last rt_schedule in rt_tick_increase * 2010-03-08 Bernard remove rt_passed_second + * 2010-05-20 Bernard fix the tick exceeds the maximum limits */ #include <rtthread.h> @@ -20,6 +21,7 @@ static rt_tick_t rt_tick; extern void rt_timer_check(void); +extern void rt_timer_switch(void); /** * This function will init system tick and set it to zero. @@ -57,10 +59,14 @@ void rt_tick_increase() struct rt_thread* thread; /* increase the global tick */ - ++ rt_tick; + if (rt_tick == RT_TICK_MAX) + { + /* switch to long timer list */ + rt_timer_switch(); - /* check timer */ - rt_timer_check(); + rt_tick = 0; + } + else ++ rt_tick; /* check time slice */ thread = rt_thread_self(); @@ -74,6 +80,9 @@ void rt_tick_increase() /* yield */ rt_thread_yield(); } + + /* check timer */ + rt_timer_check(); } /** |
