23
23
#include <rthw.h>
24
24
25
25
/* 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 ];
27
27
28
28
#ifdef RT_USING_TIMER_SOFT
29
29
@@ -39,12 +39,12 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL];
39
39
#endif /* RT_TIMER_THREAD_PRIO */
40
40
41
41
/* 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 ;
43
43
/* 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 ;
46
46
ALIGN (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 ];
48
48
#endif /* RT_USING_TIMER_SOFT */
49
49
50
50
#ifdef RT_USING_HOOK
@@ -98,7 +98,7 @@ void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer))
98
98
* @param time the tick of timer
99
99
* @param flag the flag of timer
100
100
*/
101
- static void _rt_timer_init (rt_timer_t timer ,
101
+ static void _timer_init (rt_timer_t timer ,
102
102
void (* timeout )(void * parameter ),
103
103
void * parameter ,
104
104
rt_tick_t time ,
@@ -132,7 +132,7 @@ static void _rt_timer_init(rt_timer_t timer,
132
132
*
133
133
* @return rt_tick_t the point of timer
134
134
*/
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 [])
136
136
{
137
137
struct rt_timer * timer ;
138
138
register rt_base_t level ;
@@ -159,7 +159,7 @@ static rt_tick_t rt_timer_list_next_timeout(rt_list_t timer_list[])
159
159
*
160
160
* @param timer the point of timer
161
161
*/
162
- rt_inline void _rt_timer_remove (rt_timer_t timer )
162
+ rt_inline void _timer_remove (rt_timer_t timer )
163
163
{
164
164
int i ;
165
165
@@ -176,7 +176,7 @@ rt_inline void _rt_timer_remove(rt_timer_t timer)
176
176
* @param timer
177
177
* @return int the count
178
178
*/
179
- static int rt_timer_count_height (struct rt_timer * timer )
179
+ static int _timer_count_height (struct rt_timer * timer )
180
180
{
181
181
int i , cnt = 0 ;
182
182
@@ -203,7 +203,7 @@ void rt_timer_dump(rt_list_t timer_heads[])
203
203
struct rt_timer * timer = rt_list_entry (list ,
204
204
struct rt_timer ,
205
205
row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
206
- rt_kprintf ("%d" , rt_timer_count_height (timer ));
206
+ rt_kprintf ("%d" , _timer_count_height (timer ));
207
207
}
208
208
rt_kprintf ("\n" );
209
209
}
@@ -238,7 +238,7 @@ void rt_timer_init(rt_timer_t timer,
238
238
/* timer object initialization */
239
239
rt_object_init (& (timer -> parent ), RT_Object_Class_Timer , name );
240
240
241
- _rt_timer_init (timer , timeout , parameter , time , flag );
241
+ _timer_init (timer , timeout , parameter , time , flag );
242
242
}
243
243
RTM_EXPORT (rt_timer_init );
244
244
@@ -260,7 +260,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
260
260
/* disable interrupt */
261
261
level = rt_hw_interrupt_disable ();
262
262
263
- _rt_timer_remove (timer );
263
+ _timer_remove (timer );
264
264
/* stop timer */
265
265
timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
266
266
@@ -300,7 +300,7 @@ rt_timer_t rt_timer_create(const char *name,
300
300
return RT_NULL ;
301
301
}
302
302
303
- _rt_timer_init (timer , timeout , parameter , time , flag );
303
+ _timer_init (timer , timeout , parameter , time , flag );
304
304
305
305
return timer ;
306
306
}
@@ -325,7 +325,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
325
325
/* disable interrupt */
326
326
level = rt_hw_interrupt_disable ();
327
327
328
- _rt_timer_remove (timer );
328
+ _timer_remove (timer );
329
329
/* stop timer */
330
330
timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
331
331
@@ -362,7 +362,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
362
362
/* stop timer firstly */
363
363
level = rt_hw_interrupt_disable ();
364
364
/* remove timer from list */
365
- _rt_timer_remove (timer );
365
+ _timer_remove (timer );
366
366
/* change status of timer */
367
367
timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
368
368
@@ -379,13 +379,13 @@ rt_err_t rt_timer_start(rt_timer_t timer)
379
379
if (timer -> parent .flag & RT_TIMER_FLAG_SOFT_TIMER )
380
380
{
381
381
/* insert timer to soft timer list */
382
- timer_list = rt_soft_timer_list ;
382
+ timer_list = _soft_timer_list ;
383
383
}
384
384
else
385
385
#endif /* RT_USING_TIMER_SOFT */
386
386
{
387
387
/* insert timer to system timer list */
388
- timer_list = rt_timer_list ;
388
+ timer_list = _timer_list ;
389
389
}
390
390
391
391
row_head [0 ] = & timer_list [0 ];
@@ -448,11 +448,11 @@ rt_err_t rt_timer_start(rt_timer_t timer)
448
448
if (timer -> parent .flag & RT_TIMER_FLAG_SOFT_TIMER )
449
449
{
450
450
/* 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 ))
453
453
{
454
454
/* resume timer thread to check soft timer */
455
- rt_thread_resume (& timer_thread );
455
+ rt_thread_resume (& _timer_thread );
456
456
rt_schedule ();
457
457
}
458
458
}
@@ -485,7 +485,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer)
485
485
/* disable interrupt */
486
486
level = rt_hw_interrupt_disable ();
487
487
488
- _rt_timer_remove (timer );
488
+ _timer_remove (timer );
489
489
/* change status */
490
490
timer -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
491
491
@@ -576,9 +576,9 @@ void rt_timer_check(void)
576
576
/* disable interrupt */
577
577
level = rt_hw_interrupt_disable ();
578
578
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 ]))
580
580
{
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 ,
582
582
struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
583
583
584
584
/*
@@ -590,7 +590,7 @@ void rt_timer_check(void)
590
590
RT_OBJECT_HOOK_CALL (rt_timer_enter_hook , (t ));
591
591
592
592
/* remove timer from timer list firstly */
593
- _rt_timer_remove (t );
593
+ _timer_remove (t );
594
594
if (!(t -> parent .flag & RT_TIMER_FLAG_PERIODIC ))
595
595
{
596
596
t -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
@@ -636,7 +636,7 @@ void rt_timer_check(void)
636
636
*/
637
637
rt_tick_t rt_timer_next_timeout_tick (void )
638
638
{
639
- return rt_timer_list_next_timeout ( rt_timer_list );
639
+ return _timer_list_next_timeout ( _timer_list );
640
640
}
641
641
642
642
#ifdef RT_USING_TIMER_SOFT
@@ -658,9 +658,9 @@ void rt_soft_timer_check(void)
658
658
/* disable interrupt */
659
659
level = rt_hw_interrupt_disable ();
660
660
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 ]))
662
662
{
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 ,
664
664
struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
665
665
666
666
current_tick = rt_tick_get ();
@@ -674,15 +674,15 @@ void rt_soft_timer_check(void)
674
674
RT_OBJECT_HOOK_CALL (rt_timer_enter_hook , (t ));
675
675
676
676
/* remove timer from timer list firstly */
677
- _rt_timer_remove (t );
677
+ _timer_remove (t );
678
678
if (!(t -> parent .flag & RT_TIMER_FLAG_PERIODIC ))
679
679
{
680
680
t -> parent .flag &= ~RT_TIMER_FLAG_ACTIVATED ;
681
681
}
682
682
/* add timer to temporary list */
683
683
rt_list_insert_after (& list , & (t -> row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]));
684
684
685
- soft_timer_status = RT_SOFT_TIMER_BUSY ;
685
+ _soft_timer_status = RT_SOFT_TIMER_BUSY ;
686
686
/* enable interrupt */
687
687
rt_hw_interrupt_enable (level );
688
688
@@ -695,7 +695,7 @@ void rt_soft_timer_check(void)
695
695
/* disable interrupt */
696
696
level = rt_hw_interrupt_disable ();
697
697
698
- soft_timer_status = RT_SOFT_TIMER_IDLE ;
698
+ _soft_timer_status = RT_SOFT_TIMER_IDLE ;
699
699
/* Check whether the timer object is detached or started again */
700
700
if (rt_list_isempty (& list ))
701
701
{
@@ -723,14 +723,14 @@ void rt_soft_timer_check(void)
723
723
*
724
724
* @param parameter
725
725
*/
726
- static void rt_thread_timer_entry (void * parameter )
726
+ static void _timer_thread_entry (void * parameter )
727
727
{
728
728
rt_tick_t next_timeout ;
729
729
730
730
while (1 )
731
731
{
732
732
/* 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 );
734
734
if (next_timeout == RT_TICK_MAX )
735
735
{
736
736
/* no software timer exist, suspend self. */
@@ -767,9 +767,9 @@ void rt_system_timer_init(void)
767
767
{
768
768
int i ;
769
769
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 ++ )
771
771
{
772
- rt_list_init (rt_timer_list + i );
772
+ rt_list_init (_timer_list + i );
773
773
}
774
774
}
775
775
@@ -784,24 +784,24 @@ void rt_system_timer_thread_init(void)
784
784
int i ;
785
785
786
786
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 ]);
788
788
i ++ )
789
789
{
790
- rt_list_init (rt_soft_timer_list + i );
790
+ rt_list_init (_soft_timer_list + i );
791
791
}
792
792
793
793
/* start software timer thread */
794
- rt_thread_init (& timer_thread ,
794
+ rt_thread_init (& _timer_thread ,
795
795
"timer" ,
796
- rt_thread_timer_entry ,
796
+ _timer_thread_entry ,
797
797
RT_NULL ,
798
- & timer_thread_stack [0 ],
799
- sizeof (timer_thread_stack ),
798
+ & _timer_thread_stack [0 ],
799
+ sizeof (_timer_thread_stack ),
800
800
RT_TIMER_THREAD_PRIO ,
801
801
10 );
802
802
803
803
/* startup */
804
- rt_thread_startup (& timer_thread );
804
+ rt_thread_startup (& _timer_thread );
805
805
#endif /* RT_USING_TIMER_SOFT */
806
806
}
807
807
0 commit comments