kernel: Refactor remaining time evaluation for timeouts
Factor out the code for evaluating the remaining time for _timeout structs so that it can also be used for other objects besides k_timer structs (like k_delayed_work, coming in a subsequent patch). Change-Id: I243a7b29fb2831f06e95086a31f0d3a6c37dad67 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
142c0024de
commit
f99ad3f0e2
2 changed files with 9 additions and 5 deletions
|
@ -654,6 +654,8 @@ struct _timeout {
|
|||
_timeout_func_t func;
|
||||
};
|
||||
|
||||
extern int32_t _timeout_remaining_get(struct _timeout *timeout);
|
||||
|
||||
/**
|
||||
* INTERNAL_HIDDEN @endcond
|
||||
*/
|
||||
|
@ -852,7 +854,10 @@ extern uint32_t k_timer_status_sync(struct k_timer *timer);
|
|||
*
|
||||
* @return Remaining time (in milliseconds).
|
||||
*/
|
||||
extern int32_t k_timer_remaining_get(struct k_timer *timer);
|
||||
static inline int32_t k_timer_remaining_get(struct k_timer *timer)
|
||||
{
|
||||
return _timeout_remaining_get(&timer->timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end defgroup timer_apis
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue