kernel: const-qualify objects used to calculate delay values
The internal API to measure time until a delay expires does not modify the referenced timeout. Make the functions that call it take pointers to const objects, so that they can be used with pointer to const-qualified containers. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
f9b76ca76e
commit
0ab314f705
3 changed files with 19 additions and 15 deletions
|
@ -556,10 +556,10 @@ extern k_ticks_t z_timeout_remaining(const struct _timeout *timeout);
|
|||
* executes, in units of system ticks. If the thread is not waiting,
|
||||
* it returns current system time.
|
||||
*/
|
||||
__syscall k_ticks_t k_thread_timeout_expires_ticks(struct k_thread *t);
|
||||
__syscall k_ticks_t k_thread_timeout_expires_ticks(const struct k_thread *t);
|
||||
|
||||
static inline k_ticks_t z_impl_k_thread_timeout_expires_ticks(
|
||||
struct k_thread *t)
|
||||
const struct k_thread *t)
|
||||
{
|
||||
return z_timeout_expires(&t->base.timeout);
|
||||
}
|
||||
|
@ -571,10 +571,10 @@ static inline k_ticks_t z_impl_k_thread_timeout_expires_ticks(
|
|||
* next executes, in units of system ticks. If the thread is not
|
||||
* waiting, it returns zero.
|
||||
*/
|
||||
__syscall k_ticks_t k_thread_timeout_remaining_ticks(struct k_thread *t);
|
||||
__syscall k_ticks_t k_thread_timeout_remaining_ticks(const struct k_thread *t);
|
||||
|
||||
static inline k_ticks_t z_impl_k_thread_timeout_remaining_ticks(
|
||||
struct k_thread *t)
|
||||
const struct k_thread *t)
|
||||
{
|
||||
return z_timeout_remaining(&t->base.timeout);
|
||||
}
|
||||
|
@ -1443,9 +1443,10 @@ __syscall uint32_t k_timer_status_sync(struct k_timer *timer);
|
|||
* @param timer The timer object
|
||||
* @return Uptime of expiration, in ticks
|
||||
*/
|
||||
__syscall k_ticks_t k_timer_expires_ticks(struct k_timer *timer);
|
||||
__syscall k_ticks_t k_timer_expires_ticks(const struct k_timer *timer);
|
||||
|
||||
static inline k_ticks_t z_impl_k_timer_expires_ticks(struct k_timer *timer)
|
||||
static inline k_ticks_t z_impl_k_timer_expires_ticks(
|
||||
const struct k_timer *timer)
|
||||
{
|
||||
return z_timeout_expires(&timer->timeout);
|
||||
}
|
||||
|
@ -1457,9 +1458,10 @@ static inline k_ticks_t z_impl_k_timer_expires_ticks(struct k_timer *timer)
|
|||
* next expires, in units of system ticks. If the timer is not
|
||||
* running, it returns zero.
|
||||
*/
|
||||
__syscall k_ticks_t k_timer_remaining_ticks(struct k_timer *timer);
|
||||
__syscall k_ticks_t k_timer_remaining_ticks(const struct k_timer *timer);
|
||||
|
||||
static inline k_ticks_t z_impl_k_timer_remaining_ticks(struct k_timer *timer)
|
||||
static inline k_ticks_t z_impl_k_timer_remaining_ticks(
|
||||
const struct k_timer *timer)
|
||||
{
|
||||
return z_timeout_remaining(&timer->timeout);
|
||||
}
|
||||
|
@ -2899,7 +2901,7 @@ static inline int k_delayed_work_submit(struct k_delayed_work *work,
|
|||
* @return Uptime of execution (in ticks).
|
||||
*/
|
||||
static inline k_ticks_t k_delayed_work_expires_ticks(
|
||||
struct k_delayed_work *work)
|
||||
const struct k_delayed_work *work)
|
||||
{
|
||||
return z_timeout_expires(&work->timeout);
|
||||
}
|
||||
|
@ -2917,7 +2919,7 @@ static inline k_ticks_t k_delayed_work_expires_ticks(
|
|||
* @return Remaining time (in ticks).
|
||||
*/
|
||||
static inline k_ticks_t k_delayed_work_remaining_ticks(
|
||||
struct k_delayed_work *work)
|
||||
const struct k_delayed_work *work)
|
||||
{
|
||||
return z_timeout_remaining(&work->timeout);
|
||||
}
|
||||
|
@ -2933,7 +2935,7 @@ static inline k_ticks_t k_delayed_work_remaining_ticks(
|
|||
*
|
||||
* @return Remaining time (in milliseconds).
|
||||
*/
|
||||
static inline int32_t k_delayed_work_remaining_get(struct k_delayed_work *work)
|
||||
static inline int32_t k_delayed_work_remaining_get(const struct k_delayed_work *work)
|
||||
{
|
||||
return k_ticks_to_ms_floor32(z_timeout_remaining(&work->timeout));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue