From b27c7e482648535760e012cd6f1afef1d800e2d2 Mon Sep 17 00:00:00 2001 From: bernard Date: Sun, 15 Oct 2017 22:31:53 +0800 Subject: [Kernel] Add signal implementation. 1. Add signal implementation; 2. Change the 'rt_uint8_t' of cmd to 'int'; --- src/clock.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/clock.c') diff --git a/src/clock.c b/src/clock.c index 36e26238ed..734c0d5014 100644 --- a/src/clock.c +++ b/src/clock.c @@ -108,13 +108,23 @@ void rt_tick_increase(void) * This function will calculate the tick from millisecond. * * @param ms the specified millisecond + * - Negative Number wait forever + * - Zero not wait + * - Max 0x7fffffff * * @return the calculated tick */ -rt_tick_t rt_tick_from_millisecond(rt_uint32_t ms) +int rt_tick_from_millisecond(rt_int32_t ms) { + int tick; + + if (ms < 0) + tick = RT_WAITING_FOREVER; + else + tick = (RT_TICK_PER_SECOND * ms + 999) / 1000; + /* return the calculated tick */ - return (RT_TICK_PER_SECOND * ms + 999) / 1000; + return tick; } RTM_EXPORT(rt_tick_from_millisecond); -- cgit v1.3.1