update kernel examples
fixed an error in timer_control.c git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1730 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
b886a19bf9
commit
9bb329daee
@ -135,8 +135,7 @@ void tc_start(const char* tc_prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rt_memset(_tc_prefix, 0, sizeof(_tc_prefix));
|
rt_memset(_tc_prefix, 0, sizeof(_tc_prefix));
|
||||||
rt_snprintf(_tc_prefix, sizeof(_tc_prefix),
|
rt_snprintf(_tc_prefix, sizeof(_tc_prefix), "_tc_%s", tc_prefix);
|
||||||
"_tc_%s", tc_prefix);
|
|
||||||
|
|
||||||
result = rt_thread_init(&_tc_thread, "tc",
|
result = rt_thread_init(&_tc_thread, "tc",
|
||||||
tc_thread_entry, RT_NULL,
|
tc_thread_entry, RT_NULL,
|
||||||
|
@ -62,6 +62,9 @@ static void _tc_cleanup()
|
|||||||
|
|
||||||
/* 调度器解锁 */
|
/* 调度器解锁 */
|
||||||
rt_exit_critical();
|
rt_exit_critical();
|
||||||
|
|
||||||
|
/* 设置TestCase状态 */
|
||||||
|
tc_done(TC_STAT_PASSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _tc_thread_dynamic_simple()
|
int _tc_thread_dynamic_simple()
|
||||||
|
@ -49,6 +49,7 @@ int thread_priority_init()
|
|||||||
thread1_entry, RT_NULL,
|
thread1_entry, RT_NULL,
|
||||||
&thread1_stack[0], sizeof(thread1_stack),
|
&thread1_stack[0], sizeof(thread1_stack),
|
||||||
THREAD_PRIORITY - 1, THREAD_TIMESLICE);
|
THREAD_PRIORITY - 1, THREAD_TIMESLICE);
|
||||||
|
|
||||||
if (result == RT_EOK)
|
if (result == RT_EOK)
|
||||||
rt_thread_startup(&thread1);
|
rt_thread_startup(&thread1);
|
||||||
else
|
else
|
||||||
|
@ -72,6 +72,9 @@ static void _tc_cleanup()
|
|||||||
|
|
||||||
/* 调度器解锁 */
|
/* 调度器解锁 */
|
||||||
rt_exit_critical();
|
rt_exit_critical();
|
||||||
|
|
||||||
|
/* 设置TestCase状态 */
|
||||||
|
tc_done(TC_STAT_PASSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _tc_thread_static_simple()
|
int _tc_thread_static_simple()
|
||||||
|
@ -13,6 +13,8 @@ static rt_uint8_t count;
|
|||||||
/* 定时器超时函数 */
|
/* 定时器超时函数 */
|
||||||
static void timeout1(void* parameter)
|
static void timeout1(void* parameter)
|
||||||
{
|
{
|
||||||
|
rt_tick_t timeout = 50;
|
||||||
|
|
||||||
rt_kprintf("periodic timer is timeout\n");
|
rt_kprintf("periodic timer is timeout\n");
|
||||||
|
|
||||||
count ++;
|
count ++;
|
||||||
@ -20,7 +22,7 @@ static void timeout1(void* parameter)
|
|||||||
if (count >= 8)
|
if (count >= 8)
|
||||||
{
|
{
|
||||||
/* 控制定时器然后更改超时时间长度 */
|
/* 控制定时器然后更改超时时间长度 */
|
||||||
rt_timer_control(timer1, RT_TIMER_CTRL_SET_TIME, (void*)50);
|
rt_timer_control(timer1, RT_TIMER_CTRL_SET_TIME, (void *)&timeout);
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user