summaryrefslogtreecommitdiff
path: root/src/clock.c
diff options
context:
space:
mode:
authorshaojinchun <[email protected]>2018-11-22 14:40:43 +0800
committershaojinchun <[email protected]>2018-11-22 18:16:47 +0800
commitfc6bc1ad398d5fa2085320cab6cc33905f5f943d (patch)
treea6a24a6e516add6fe47fa5a58f7307ee0cd3f6e8 /src/clock.c
parent8ea5b770117cacea7f17b2b08305f360ed71bca7 (diff)
Add smp support to RT-Thread 4.0
Diffstat (limited to 'src/clock.c')
-rw-r--r--src/clock.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/clock.c b/src/clock.c
index 651465e0a8..1bedb4e06a 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -12,12 +12,17 @@
* 2010-05-20 Bernard fix the tick exceeds the maximum limits
* 2010-07-13 Bernard fix rt_tick_from_millisecond issue found by kuronca
* 2011-06-26 Bernard add rt_tick_set function.
+ * 2018-11-22 Jesven add per cpu tick
*/
#include <rthw.h>
#include <rtthread.h>
+#ifdef RT_USING_SMP
+#define rt_tick rt_cpu_index(0)->tick
+#else
static rt_tick_t rt_tick = 0;
+#endif
extern void rt_timer_check(void);
@@ -71,7 +76,11 @@ void rt_tick_increase(void)
struct rt_thread *thread;
/* increase the global tick */
+#ifdef RT_USING_SMP
+ rt_cpu_self()->tick ++;
+#else
++ rt_tick;
+#endif
/* check time slice */
thread = rt_thread_self();