mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-06 02:40:45 +08:00
fix the timer check bug.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@730 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
b34d10449f
commit
0eaf2098b8
3 files changed
+106
-22
No files matched your search
@@ -55,6 +55,7 @@ typedef rt_uint32_t rt_off_t; /* Type for offset. */
|
||||
#define RT_UINT8_MAX 0xff /* Maxium number of UINT8. */
|
||||
#define RT_UINT16_MAX 0xffff /* Maxium number of UINT16. */
|
||||
#define RT_UINT32_MAX 0xffffffff /* Maxium number of UINT32. */
|
||||
#define RT_TICK_MAX RT_UINT32_MAX /* Maxium number of tick */
|
||||
|
||||
/* Compiler Related Definitions */
|
||||
#ifdef __CC_ARM /* ARM Compiler */
|
||||
|
||||
+13
-4
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+92
-18
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user