2323#include <rthw.h>
2424
2525/* hard timer list */
26- static rt_list_t rt_timer_list [RT_TIMER_SKIP_LIST_LEVEL ];
26+ static rt_list_t _timer_list [RT_TIMER_SKIP_LIST_LEVEL ];
2727
2828#ifdef RT_USING_TIMER_SOFT
2929
@@ -39,12 +39,12 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL];
3939#endif /* RT_TIMER_THREAD_PRIO */
4040
4141/* soft timer status */
42- static rt_uint8_t soft_timer_status = RT_SOFT_TIMER_IDLE ;
42+ static rt_uint8_t _soft_timer_status = RT_SOFT_TIMER_IDLE ;
4343/* soft timer list */
44- static rt_list_t rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL ];
45- static struct rt_thread timer_thread ;
44+ static rt_list_t _soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL ];
45+ static struct rt_thread _timer_thread ;
4646ALIGN (RT_ALIGN_SIZE )
47- static rt_uint8_t timer_thread_stack [RT_TIMER_THREAD_STACK_SIZE ];
47+ static rt_uint8_t _timer_thread_stack [RT_TIMER_THREAD_STACK_SIZE ];
4848#endif /* RT_USING_TIMER_SOFT */
4949
5050#ifdef RT_USING_HOOK
@@ -98,7 +98,7 @@ void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer))
9898 * @param time the tick of timer
9999 * @param flag the flag of timer
100100 */
101- static void _rt_timer_init (rt_timer_t timer ,
101+ static void _timer_init (rt_timer_t timer ,
102102 void (* timeout )(void * parameter ),
103103 void * parameter ,
104104 rt_tick_t time ,
@@ -132,7 +132,7 @@ static void _rt_timer_init(rt_timer_t timer,
132132 *
133133 * @return rt_tick_t the point of timer
134134 */
135- static rt_tick_t rt_timer_list_next_timeout (rt_list_t timer_list [])
135+ static rt_tick_t _timer_list_next_timeout (rt_list_t timer_list [])
136136{
137137 struct rt_timer * timer ;
138138 register rt_base_t level ;
@@ -159,7 +159,7 @@ static rt_tick_t rt_timer_list_next_timeout(rt_list_t timer_list[])
159159 *
160160 * @param timer the point of timer
161161 */
162- rt_inline void _rt_timer_remove (rt_timer_t timer )
162+ rt_inline void _timer_remove (rt_timer_t timer )
163163{
164164 int i ;
165165
@@ -176,7 +176,7 @@ rt_inline void _rt_timer_remove(rt_timer_t timer)
176176 * @param timer
177177 * @return int the count
178178 */
179- static int rt_timer_count_height (struct rt_timer * timer )
179+ static int _timer_count_height (struct rt_timer * timer )
180180{
181181 int i , cnt = 0 ;
182182
@@ -203,7 +203,7 @@ void rt_timer_dump(rt_list_t timer_heads[])
203203 struct rt_timer * timer = rt_list_entry (list ,
204204 struct rt_timer ,
205205 row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
206- rt_kprintf ("%d" , rt_timer_count_height (timer ));
206+ rt_kprintf ("%d" , _timer_count_height (timer ));
207207 }
208208 rt_kprintf ("\n" );
209209}
@@ -238,7 +238,7 @@ void rt_timer_init(rt_timer_t timer,
238238 /* timer object initialization */
239239 rt_object_init (& (timer -> parent ), RT_Object_Class_Timer , name );
240240
241- _rt_timer_init (timer , timeout , parameter , time , flag );
241+ _timer_init (timer , timeout , parameter , time , flag );
242242}
243243RTM_EXPORT (rt_timer_init );
244244
@@ -260,7 +260,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
260260 /* disable interrupt */
261261 level = rt_hw_interrupt_disable ();
262262
263- _rt_timer_remove (timer );
263+ _timer_remove (timer );
264264 /* stop timer */
265265 timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
266266
@@ -300,7 +300,7 @@ rt_timer_t rt_timer_create(const char *name,
300300 return RT_NULL ;
301301 }
302302
303- _rt_timer_init (timer , timeout , parameter , time , flag );
303+ _timer_init (timer , timeout , parameter , time , flag );
304304
305305 return timer ;
306306}
@@ -325,7 +325,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
325325 /* disable interrupt */
326326 level = rt_hw_interrupt_disable ();
327327
328- _rt_timer_remove (timer );
328+ _timer_remove (timer );
329329 /* stop timer */
330330 timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
331331
@@ -362,7 +362,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
362362 /* stop timer firstly */
363363 level = rt_hw_interrupt_disable ();
364364 /* remove timer from list */
365- _rt_timer_remove (timer );
365+ _timer_remove (timer );
366366 /* change status of timer */
367367 timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
368368
@@ -379,13 +379,13 @@ rt_err_t rt_timer_start(rt_timer_t timer)
379379 if (timer -> parent .flag & RT_TIMER_FLAG_SOFT_TIMER )
380380 {
381381 /* insert timer to soft timer list */
382- timer_list = rt_soft_timer_list ;
382+ timer_list = _soft_timer_list ;
383383 }
384384 else
385385#endif /* RT_USING_TIMER_SOFT */
386386 {
387387 /* insert timer to system timer list */
388- timer_list = rt_timer_list ;
388+ timer_list = _timer_list ;
389389 }
390390
391391 row_head [0 ] = & timer_list [0 ];
@@ -448,11 +448,11 @@ rt_err_t rt_timer_start(rt_timer_t timer)
448448 if (timer -> parent .flag & RT_TIMER_FLAG_SOFT_TIMER )
449449 {
450450 /* check whether timer thread is ready */
451- if ((soft_timer_status == RT_SOFT_TIMER_IDLE ) &&
452- ((timer_thread .stat & RT_THREAD_STAT_MASK ) == RT_THREAD_SUSPEND ))
451+ if ((_soft_timer_status == RT_SOFT_TIMER_IDLE ) &&
452+ ((_timer_thread .stat & RT_THREAD_STAT_MASK ) == RT_THREAD_SUSPEND ))
453453 {
454454 /* resume timer thread to check soft timer */
455- rt_thread_resume (& timer_thread );
455+ rt_thread_resume (& _timer_thread );
456456 rt_schedule ();
457457 }
458458 }
@@ -485,7 +485,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer)
485485 /* disable interrupt */
486486 level = rt_hw_interrupt_disable ();
487487
488- _rt_timer_remove (timer );
488+ _timer_remove (timer );
489489 /* change status */
490490 timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
491491
@@ -576,9 +576,9 @@ void rt_timer_check(void)
576576 /* disable interrupt */
577577 level = rt_hw_interrupt_disable ();
578578
579- while (!rt_list_isempty (& rt_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]))
579+ while (!rt_list_isempty (& _timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]))
580580 {
581- t = rt_list_entry (rt_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ,
581+ t = rt_list_entry (_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ,
582582 struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
583583
584584 /*
@@ -590,7 +590,7 @@ void rt_timer_check(void)
590590 RT_OBJECT_HOOK_CALL (rt_timer_enter_hook , (t ));
591591
592592 /* remove timer from timer list firstly */
593- _rt_timer_remove (t );
593+ _timer_remove (t );
594594 if (!(t -> parent .flag & RT_TIMER_FLAG_PERIODIC ))
595595 {
596596 t -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
@@ -636,7 +636,7 @@ void rt_timer_check(void)
636636 */
637637rt_tick_t rt_timer_next_timeout_tick (void )
638638{
639- return rt_timer_list_next_timeout ( rt_timer_list );
639+ return _timer_list_next_timeout ( _timer_list );
640640}
641641
642642#ifdef RT_USING_TIMER_SOFT
@@ -658,9 +658,9 @@ void rt_soft_timer_check(void)
658658 /* disable interrupt */
659659 level = rt_hw_interrupt_disable ();
660660
661- while (!rt_list_isempty (& rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]))
661+ while (!rt_list_isempty (& _soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]))
662662 {
663- t = rt_list_entry (rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ,
663+ t = rt_list_entry (_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ,
664664 struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
665665
666666 current_tick = rt_tick_get ();
@@ -674,15 +674,15 @@ void rt_soft_timer_check(void)
674674 RT_OBJECT_HOOK_CALL (rt_timer_enter_hook , (t ));
675675
676676 /* remove timer from timer list firstly */
677- _rt_timer_remove (t );
677+ _timer_remove (t );
678678 if (!(t -> parent .flag & RT_TIMER_FLAG_PERIODIC ))
679679 {
680680 t -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
681681 }
682682 /* add timer to temporary list */
683683 rt_list_insert_after (& list , & (t -> row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]));
684684
685- soft_timer_status = RT_SOFT_TIMER_BUSY ;
685+ _soft_timer_status = RT_SOFT_TIMER_BUSY ;
686686 /* enable interrupt */
687687 rt_hw_interrupt_enable (level );
688688
@@ -695,7 +695,7 @@ void rt_soft_timer_check(void)
695695 /* disable interrupt */
696696 level = rt_hw_interrupt_disable ();
697697
698- soft_timer_status = RT_SOFT_TIMER_IDLE ;
698+ _soft_timer_status = RT_SOFT_TIMER_IDLE ;
699699 /* Check whether the timer object is detached or started again */
700700 if (rt_list_isempty (& list ))
701701 {
@@ -723,14 +723,14 @@ void rt_soft_timer_check(void)
723723 *
724724 * @param parameter
725725 */
726- static void rt_thread_timer_entry (void * parameter )
726+ static void _timer_thread_entry (void * parameter )
727727{
728728 rt_tick_t next_timeout ;
729729
730730 while (1 )
731731 {
732732 /* get the next timeout tick */
733- next_timeout = rt_timer_list_next_timeout ( rt_soft_timer_list );
733+ next_timeout = _timer_list_next_timeout ( _soft_timer_list );
734734 if (next_timeout == RT_TICK_MAX )
735735 {
736736 /* no software timer exist, suspend self. */
@@ -767,9 +767,9 @@ void rt_system_timer_init(void)
767767{
768768 int i ;
769769
770- for (i = 0 ; i < sizeof (rt_timer_list ) / sizeof (rt_timer_list [0 ]); i ++ )
770+ for (i = 0 ; i < sizeof (_timer_list ) / sizeof (_timer_list [0 ]); i ++ )
771771 {
772- rt_list_init (rt_timer_list + i );
772+ rt_list_init (_timer_list + i );
773773 }
774774}
775775
@@ -784,24 +784,24 @@ void rt_system_timer_thread_init(void)
784784 int i ;
785785
786786 for (i = 0 ;
787- i < sizeof (rt_soft_timer_list ) / sizeof (rt_soft_timer_list [0 ]);
787+ i < sizeof (_soft_timer_list ) / sizeof (_soft_timer_list [0 ]);
788788 i ++ )
789789 {
790- rt_list_init (rt_soft_timer_list + i );
790+ rt_list_init (_soft_timer_list + i );
791791 }
792792
793793 /* start software timer thread */
794- rt_thread_init (& timer_thread ,
794+ rt_thread_init (& _timer_thread ,
795795 "timer" ,
796- rt_thread_timer_entry ,
796+ _timer_thread_entry ,
797797 RT_NULL ,
798- & timer_thread_stack [0 ],
799- sizeof (timer_thread_stack ),
798+ & _timer_thread_stack [0 ],
799+ sizeof (_timer_thread_stack ),
800800 RT_TIMER_THREAD_PRIO ,
801801 10 );
802802
803803 /* startup */
804- rt_thread_startup (& timer_thread );
804+ rt_thread_startup (& _timer_thread );
805805#endif /* RT_USING_TIMER_SOFT */
806806}
807807
0 commit comments