unified: merge NANO_TIMERS and NANO_TIMEOUTS with SYS_CLOCK_EXISTS

Timers are based off timeouts now, which can only be enabled when the
system clock is enabled. So the three are really just one setting now.

Keep the NANO_TIMERS and NANO_TIMEOUTS around for now until all
middleware that rely on them is updated. They are always enabled when
SYS_CLOCK_EXISTS is enabled.

Change-Id: Iaef1302ef9ad8fc5640542ab6d7304d67aafcfdc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-10-06 15:04:23 -04:00
commit 1a5450bb8e
9 changed files with 17 additions and 28 deletions

View file

@ -138,7 +138,7 @@ extern void k_thread_abort(k_tid_t thread);
#endif
#endif
#ifdef CONFIG_NANO_TIMEOUTS
#ifdef CONFIG_SYS_CLOCK_EXISTS
#define _THREAD_TIMEOUT_INIT(obj) \
(obj).nano_timeout = { \
.node = { {0}, {0} }, \
@ -552,7 +552,7 @@ static inline int k_work_pending(struct k_work *work)
extern void k_work_q_start(struct k_work_q *work_q,
const struct k_thread_config *config);
#if defined(CONFIG_NANO_TIMEOUTS)
#if defined(CONFIG_SYS_CLOCK_EXISTS)
/*
* @brief An item which can be scheduled on a @ref k_work_q with a
@ -607,7 +607,7 @@ extern int k_delayed_work_submit_to_queue(struct k_work_q *work_q,
*/
extern int k_delayed_work_cancel(struct k_delayed_work *work);
#endif /* CONFIG_NANO_TIMEOUTS */
#endif /* CONFIG_SYS_CLOCK_EXISTS */
#if defined(CONFIG_SYSTEM_WORKQUEUE)
@ -627,7 +627,7 @@ static inline void k_work_submit(struct k_work *work)
k_work_submit_to_queue(&k_sys_work_q, work);
}
#if defined(CONFIG_NANO_TIMEOUTS)
#if defined(CONFIG_SYS_CLOCK_EXISTS)
/*
* @brief Submit a delayed work item to the system workqueue.
*
@ -643,7 +643,7 @@ static inline int k_delayed_work_submit(struct k_delayed_work *work,
return k_delayed_work_submit_to_queue(&k_sys_work_q, work, ticks);
}
#endif /* CONFIG_NANO_TIMEOUTS */
#endif /* CONFIG_SYS_CLOCK_EXISTS */
#endif /* CONFIG_SYSTEM_WORKQUEUE */
/**

View file

@ -132,22 +132,19 @@ config THREAD_CUSTOM_DATA
config NANO_TIMEOUTS
bool
prompt "Enable timeouts on nanokernel objects"
default y
depends on SYS_CLOCK_EXISTS
help
Allow fibers and tasks to wait on nanokernel objects with a timeout, by
enabling the nano_xxx_wait_timeout APIs, and allow fibers to sleep for a
period of time, by enabling the fiber_sleep API.
Only here for common (ie. non-unified kernel) code that rely on this.
Unified kernel uses SYS_CLOCK_EXISTS everywhere instead.
config NANO_TIMERS
bool
prompt "Enable nanokernel timers"
default y
depends on SYS_CLOCK_EXISTS
help
Allow fibers and tasks to wait on nanokernel timers, which can be
accessed using the nano_timer_xxx() APIs.
Only here for common (ie. non-unified kernel) code that rely on this.
Unified kernel uses SYS_CLOCK_EXISTS everywhere instead.
config NUM_DYNAMIC_TIMERS
int

View file

@ -38,7 +38,7 @@ lib-y += $(strip \
lib-$(CONFIG_INT_LATENCY_BENCHMARK) += int_latency_bench.o
lib-$(CONFIG_STACK_CANARIES) += compiler_stack_protect.o
lib-$(CONFIG_NANO_TIMERS) += timer.o
lib-$(CONFIG_SYS_CLOCK_EXISTS) += timer.o
lib-$(CONFIG_KERNEL_EVENT_LOGGER) += event_logger.o
lib-$(CONFIG_KERNEL_EVENT_LOGGER) += kernel_event_logger.o
lib-$(CONFIG_RING_BUFFER) += ring_buffer.o

View file

@ -29,7 +29,7 @@
extern "C" {
#endif
#if defined(CONFIG_NANO_TIMEOUTS)
#if defined(CONFIG_SYS_CLOCK_EXISTS)
/* initialize the nano timeouts part of k_thread when enabled in the kernel */
static inline void _init_timeout(struct _timeout *t, _timeout_func_t func)
@ -93,7 +93,7 @@ static inline void _unpend_thread_timing_out(struct k_thread *thread,
#else
#define _unpend_thread_timing_out(thread, timeout_obj) do { } while (0)
#endif /* CONFIG_NANO_TIMEOUTS */
#endif /* CONFIG_SYS_CLOCK_EXISTS */
/*
* Handle one expired timeout.

View file

@ -30,20 +30,12 @@
extern "C" {
#endif
#if defined(CONFIG_NANO_TIMEOUTS)
#include <timeout_q.h>
#elif defined(CONFIG_NANO_TIMERS)
#include <timeout_q.h>
#define _init_thread_timeout(thread) do { } while ((0))
#define _abort_thread_timeout(thread) do { } while ((0))
#define _add_thread_timeout(thread, pq, ticks) do { } while (0)
#else
#if !defined(CONFIG_SYS_CLOCK_EXISTS)
#define _init_thread_timeout(thread) do { } while ((0))
#define _abort_thread_timeout(thread) do { } while ((0))
#define _get_next_timeout_expiry() (K_FOREVER)
#define _add_thread_timeout(thread, pq, ticks) do { } while (0)
#endif

View file

@ -101,7 +101,7 @@ k_tid_t const _idle_thread = (k_tid_t)idle_stack;
#endif
char __noinit __stack _interrupt_stack[CONFIG_ISR_STACK_SIZE];
#if defined(CONFIG_NANO_TIMEOUTS) || defined(CONFIG_NANO_TIMERS)
#ifdef CONFIG_SYS_CLOCK_EXISTS
#include <misc/dlist.h>
#define initialize_timeouts() do { \
sys_dlist_init(&_nanokernel.timeout_q); \

View file

@ -6,4 +6,4 @@ obj-y =
obj-y += $(strip \
)
obj-$(CONFIG_NANO_TIMERS) += timer_legacy.o
obj-$(CONFIG_SYS_CLOCK_EXISTS) += timer_legacy.o

View file

@ -173,7 +173,7 @@ uint32_t k_uptime_delta_32(int64_t *reftime)
/* handle the expired timeouts in the nano timeout queue */
#if defined(CONFIG_NANO_TIMEOUTS) || defined(CONFIG_NANO_TIMERS)
#ifdef CONFIG_SYS_CLOCK_EXISTS
#include <wait_q.h>
static inline void handle_expired_timeouts(int32_t ticks)

View file

@ -266,7 +266,7 @@ static void start_thread(struct k_thread *thread)
static void schedule_new_thread(struct k_thread *thread, int32_t delay)
{
#ifdef CONFIG_NANO_TIMEOUTS
#ifdef CONFIG_SYS_CLOCK_EXISTS
if (delay == 0) {
start_thread(thread);
} else {