diff --git a/src/clock.c b/src/clock.c index 7e68d20899..436ab3a8a8 100644 --- a/src/clock.c +++ b/src/clock.c @@ -49,8 +49,8 @@ void rt_system_tick_init(void) */ rt_tick_t rt_tick_get(void) { - /* return the global tick */ - return rt_tick; + /* return the global tick */ + return rt_tick; } RTM_EXPORT(rt_tick_get); @@ -59,11 +59,11 @@ RTM_EXPORT(rt_tick_get); */ void rt_tick_set(rt_tick_t tick) { - rt_base_t level; + rt_base_t level; - level = rt_hw_interrupt_disable(); - rt_tick = tick; - rt_hw_interrupt_enable(level); + level = rt_hw_interrupt_disable(); + rt_tick = tick; + rt_hw_interrupt_enable(level); } /** @@ -72,26 +72,26 @@ void rt_tick_set(rt_tick_t tick) */ void rt_tick_increase(void) { - struct rt_thread *thread; + struct rt_thread *thread; - /* increase the global tick */ - ++ rt_tick; + /* increase the global tick */ + ++ rt_tick; - /* check time slice */ - thread = rt_thread_self(); + /* check time slice */ + thread = rt_thread_self(); - -- thread->remaining_tick; - if (thread->remaining_tick == 0) - { - /* change to initialized tick */ - thread->remaining_tick = thread->init_tick; + -- thread->remaining_tick; + if (thread->remaining_tick == 0) + { + /* change to initialized tick */ + thread->remaining_tick = thread->init_tick; - /* yield */ - rt_thread_yield(); - } + /* yield */ + rt_thread_yield(); + } - /* check timer */ - rt_timer_check(); + /* check timer */ + rt_timer_check(); } /** @@ -103,8 +103,8 @@ void rt_tick_increase(void) */ rt_tick_t rt_tick_from_millisecond(rt_uint32_t ms) { - /* return the calculated tick */ - return (RT_TICK_PER_SECOND * ms + 999) / 1000; + /* return the calculated tick */ + return (RT_TICK_PER_SECOND * ms + 999) / 1000; } RTM_EXPORT(rt_tick_from_millisecond);