nano timeouts: Add support macros

The macros _NANO_TIMEOUT_TICK_GET() and _NANO_TIMEOUT_ADD() will be
used in later commits to help simplify the nanokernel APIs.

Change-Id: I668af85d775eab112953d064d9c91de607f60a59
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2016-01-07 10:41:40 -05:00 committed by Anas Nashif
commit a6b20d4c04

View file

@ -94,10 +94,22 @@ static inline void _nano_timeout_remove_tcs_from_wait_q(struct tcs *tcs)
}
}
#include <timeout_q.h>
#define _NANO_TIMEOUT_TICK_GET() sys_tick_get()
#define _NANO_TIMEOUT_ADD(pq, ticks) \
do { \
if ((ticks) != TICKS_UNLIMITED) { \
_nano_timeout_add(_nanokernel.current, (pq), (ticks)); \
} \
} while (0)
#else
#define _nano_timeout_tcs_init(tcs) do { } while ((0))
#define _nano_timeout_abort(tcs) do { } while ((0))
#define _nano_get_earliest_timeouts_deadline() ((uint32_t)TICKS_UNLIMITED)
#define _NANO_TIMEOUT_TICK_GET() 0
#define _NANO_TIMEOUT_ADD(pq, ticks) do { } while (0)
#endif
#endif /* _kernel_nanokernel_include_wait_q__h_ */