fixed the coding style
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2493 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
b45f14c038
commit
eef72f68de
33
src/timer.c
33
src/timer.c
|
@ -68,8 +68,10 @@ void rt_timer_timeout_sethook(void (*hook)(struct rt_timer *timer))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void _rt_timer_init(rt_timer_t timer,
|
static void _rt_timer_init(rt_timer_t timer,
|
||||||
void (*timeout)(void *parameter), void *parameter,
|
void (*timeout)(void *parameter),
|
||||||
rt_tick_t time, rt_uint8_t flag)
|
void *parameter,
|
||||||
|
rt_tick_t time,
|
||||||
|
rt_uint8_t flag)
|
||||||
{
|
{
|
||||||
/* set flag */
|
/* set flag */
|
||||||
timer->parent.flag = flag;
|
timer->parent.flag = flag;
|
||||||
|
@ -118,8 +120,10 @@ static rt_tick_t rt_timer_list_next_timeout(rt_list_t *timer_list)
|
||||||
*/
|
*/
|
||||||
void rt_timer_init(rt_timer_t timer,
|
void rt_timer_init(rt_timer_t timer,
|
||||||
const char *name,
|
const char *name,
|
||||||
void (*timeout)(void *parameter), void *parameter,
|
void (*timeout)(void *parameter),
|
||||||
rt_tick_t time, rt_uint8_t flag)
|
void *parameter,
|
||||||
|
rt_tick_t time,
|
||||||
|
rt_uint8_t flag)
|
||||||
{
|
{
|
||||||
/* timer check */
|
/* timer check */
|
||||||
RT_ASSERT(timer != RT_NULL);
|
RT_ASSERT(timer != RT_NULL);
|
||||||
|
@ -172,8 +176,11 @@ RTM_EXPORT(rt_timer_detach);
|
||||||
*
|
*
|
||||||
* @return the created timer object
|
* @return the created timer object
|
||||||
*/
|
*/
|
||||||
rt_timer_t rt_timer_create(const char *name, void (*timeout)(void *parameter),
|
rt_timer_t rt_timer_create(const char *name,
|
||||||
void *parameter, rt_tick_t time, rt_uint8_t flag)
|
void (*timeout)(void *parameter),
|
||||||
|
void *parameter,
|
||||||
|
rt_tick_t time,
|
||||||
|
rt_uint8_t flag)
|
||||||
{
|
{
|
||||||
struct rt_timer *timer;
|
struct rt_timer *timer;
|
||||||
|
|
||||||
|
@ -240,7 +247,10 @@ rt_err_t rt_timer_start(rt_timer_t timer)
|
||||||
|
|
||||||
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(timer->parent)));
|
RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(timer->parent)));
|
||||||
|
|
||||||
/* get timeout tick, the max timeout tick shall not great than RT_TICK_MAX/2 */
|
/*
|
||||||
|
* get timeout tick,
|
||||||
|
* the max timeout tick shall not great than RT_TICK_MAX/2
|
||||||
|
*/
|
||||||
RT_ASSERT(timer->init_tick < RT_TICK_MAX / 2);
|
RT_ASSERT(timer->init_tick < RT_TICK_MAX / 2);
|
||||||
timer->timeout_tick = rt_tick_get() + timer->init_tick;
|
timer->timeout_tick = rt_tick_get() + timer->init_tick;
|
||||||
|
|
||||||
|
@ -573,9 +583,12 @@ void rt_system_timer_thread_init(void)
|
||||||
/* start software timer thread */
|
/* start software timer thread */
|
||||||
rt_thread_init(&timer_thread,
|
rt_thread_init(&timer_thread,
|
||||||
"timer",
|
"timer",
|
||||||
rt_thread_timer_entry, RT_NULL,
|
rt_thread_timer_entry,
|
||||||
&timer_thread_stack[0], sizeof(timer_thread_stack),
|
RT_NULL,
|
||||||
RT_TIMER_THREAD_PRIO, 10);
|
&timer_thread_stack[0],
|
||||||
|
sizeof(timer_thread_stack),
|
||||||
|
RT_TIMER_THREAD_PRIO,
|
||||||
|
10);
|
||||||
|
|
||||||
/* startup */
|
/* startup */
|
||||||
rt_thread_startup(&timer_thread);
|
rt_thread_startup(&timer_thread);
|
||||||
|
|
Loading…
Reference in New Issue