_timeout_remaining_get() was a function on a struct _timeout, doing iteration on the timeout list, but it was defined in timer.c (the higher level abstraction). Move it to where it belongs. Also have it return ticks instead of ms to conform to scheme in the rest of the timeout API. And rename it to a more standard zephyr name. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2015 Wind River Systems, Inc.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_KERNEL_INCLUDE_TIMEOUT_Q_H_
|
|
#define ZEPHYR_KERNEL_INCLUDE_TIMEOUT_Q_H_
|
|
|
|
/**
|
|
* @file
|
|
* @brief timeout queue for threads on kernel objects
|
|
*/
|
|
|
|
#include <kernel.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
|
|
|
struct _thread_base;
|
|
|
|
extern u64_t z_last_tick_announced;
|
|
|
|
void _init_timeout(struct _timeout *t, _timeout_func_t fn);
|
|
|
|
void _add_timeout(struct _timeout *timeout, _timeout_func_t func,
|
|
s32_t timeout_in_ticks);
|
|
|
|
int _abort_timeout(struct _timeout *timeout);
|
|
|
|
void _init_thread_timeout(struct _thread_base *thread_base);
|
|
|
|
void _add_thread_timeout(struct k_thread *thread, s32_t timeout_in_ticks);
|
|
|
|
int _abort_thread_timeout(struct k_thread *thread);
|
|
|
|
s32_t _get_next_timeout_expiry(void);
|
|
|
|
s32_t z_timeout_remaining(struct _timeout *timeout);
|
|
|
|
#else
|
|
|
|
/* Stubs when !CONFIG_SYS_CLOCK_EXISTS */
|
|
#define _init_thread_timeout(t) do{}while(0)
|
|
#define _add_thread_timeout(th,to) do{}while(0 && (void*)to && (void*)th)
|
|
#define _abort_thread_timeout(t) (0)
|
|
#define _get_next_timeout_expiry() (K_FOREVER)
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZEPHYR_KERNEL_INCLUDE_TIMEOUT_Q_H_ */
|