summaryrefslogtreecommitdiff
path: root/src/clock.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-06-29 14:45:35 +0000
committer[email protected] <[email protected]>2011-06-29 14:45:35 +0000
commitcfd580edf472f4a596434f27c398ac74712ab169 (patch)
tree9b758a7cd909b205c1fdd06bd3992607126b1036 /src/clock.c
parent0aa5ded9c1b25a5e84ca324bcc05d44712ee6210 (diff)
add rt_tick_set function
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1551 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/clock.c')
-rw-r--r--src/clock.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/clock.c b/src/clock.c
index 9203fc57ed..f23ddc3279 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -15,8 +15,10 @@
* 2010-03-08 Bernard remove rt_passed_second
* 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.
*/
+#include <rthw.h>
#include <rtthread.h>
static rt_tick_t rt_tick;
@@ -52,6 +54,19 @@ rt_tick_t rt_tick_get()
}
/**
+ * This function will set current tick
+ */
+void rt_tick_set(rt_tick_t tick)
+{
+ rt_base_t level;
+ level = rt_hw_interrupt_disable();
+
+ rt_tick = tick;
+
+ rt_hw_interrupt_enable(level);
+}
+
+/**
* This function will notify kernel there is one tick passed. Normally,
* this function is invoked by clock ISR.
*/