diff --git a/examples/kernel/SConscript b/examples/kernel/SConscript index e8c73e994266762c7d3dfbf1373c258d6888880e..e0b795443c82912a4169e6d40914f9e50c8e050c 100644 --- a/examples/kernel/SConscript +++ b/examples/kernel/SConscript @@ -22,7 +22,10 @@ mutex_simple.c event_simple.c mbox_simple.c messageq_simple.c -timer_simple.c +timer_static.c +timer_dynamic.c +timer_stop_self.c +timer_control.c heap_malloc.c heap_realloc.c memp_simple.c diff --git a/examples/kernel/timer_control.c b/examples/kernel/timer_control.c index 7039000dfb9627f0aa46056e3b6f63e8a0b22f8c..fdee627f588f201cd32b3e88484ca0be8df605db 100644 --- a/examples/kernel/timer_control.c +++ b/examples/kernel/timer_control.c @@ -20,12 +20,12 @@ static void timeout1(void* parameter) if (count >= 8) { /* 控制定时器然后更改超时时间长度 */ - rt_timer_control(timer1, RT_TIMER_CTRL_SET_TIME, 50); + rt_timer_control(timer1, RT_TIMER_CTRL_SET_TIME, (void*)50); count = 0; } } -void timer_stop_self_init() +void timer_control_init() { /* 创建定时器1 */ timer1 = rt_timer_create("timer1", /* 定时器名字是 timer1 */ @@ -57,25 +57,25 @@ static void _tc_cleanup() tc_done(TC_STAT_PASSED); } -int _tc_timer_stop_self() +int _tc_timer_control() { /* 设置TestCase清理回调函数 */ tc_cleanup(_tc_cleanup); /* 执行定时器例程 */ count = 0; - timer_stop_self_init(); + timer_control_init(); /* 返回TestCase运行的最长时间 */ return 100; } /* 输出函数命令到finsh shell中 */ -FINSH_FUNCTION_EXPORT(_tc_timer_stop_self, a dynamic timer example); +FINSH_FUNCTION_EXPORT(_tc_timer_control, a timer control example); #else /* 用户应用入口 */ int rt_application_init() { - timer_stop_self_init(); + timer_control_init(); return 0; } diff --git a/examples/kernel/timer_dynamic.c b/examples/kernel/timer_dynamic.c index a4f5ed947f1fbdfdd93ef911e0ca9cde1fcc3e23..b28a4c9056a50e11cdaa7bb31e02e77d85cde94e 100644 --- a/examples/kernel/timer_dynamic.c +++ b/examples/kernel/timer_dynamic.c @@ -11,13 +11,13 @@ static rt_timer_t timer1; static rt_timer_t timer2; /* 定时器1超时函数 */ -void timeout1(void* parameter) +static void timeout1(void* parameter) { rt_kprintf("periodic timer is timeout\n"); } /* 定时器2超时函数 */ -void timeout2(void* parameter) +static void timeout2(void* parameter) { rt_kprintf("one shot timer is timeout\n"); } diff --git a/examples/kernel/timer_static.c b/examples/kernel/timer_static.c index 9009bf62d901024426899a7eedffa3546eba4370..bddfe63af3ea472e9839b831ffd9b70230603fe1 100644 --- a/examples/kernel/timer_static.c +++ b/examples/kernel/timer_static.c @@ -70,7 +70,7 @@ int _tc_timer_static() return 100; } /* 输出函数命令到finsh shell中 */ -FINSH_FUNCTION_EXPORT(_tc_timer_static, a simple timer example); +FINSH_FUNCTION_EXPORT(_tc_timer_static, a static timer example); #else /* 用户应用入口 */ int rt_application_init()