diff options
| author | bernard <[email protected]> | 2017-10-15 22:31:53 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-10-15 22:31:53 +0800 |
| commit | b27c7e482648535760e012cd6f1afef1d800e2d2 (patch) | |
| tree | ad040fd4e7579e67ba6ee2edae468b63f2099a0e /src/clock.c | |
| parent | cd215b25455bf06dfeb8885fe4d8f5b30174a8c3 (diff) | |
[Kernel] Add signal implementation.
1. Add signal implementation;
2. Change the 'rt_uint8_t' of cmd to 'int';
Diffstat (limited to 'src/clock.c')
| -rw-r--r-- | src/clock.c | 14 |
1 files changed, 12 insertions, 2 deletions
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); |
