162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#define TIMER_RETRY 1
362306a36Sopenharmony_ci
462306a36Sopenharmony_cistruct k_clock {
562306a36Sopenharmony_ci	int	(*clock_getres)(const clockid_t which_clock,
662306a36Sopenharmony_ci				struct timespec64 *tp);
762306a36Sopenharmony_ci	int	(*clock_set)(const clockid_t which_clock,
862306a36Sopenharmony_ci			     const struct timespec64 *tp);
962306a36Sopenharmony_ci	/* Returns the clock value in the current time namespace. */
1062306a36Sopenharmony_ci	int	(*clock_get_timespec)(const clockid_t which_clock,
1162306a36Sopenharmony_ci				      struct timespec64 *tp);
1262306a36Sopenharmony_ci	/* Returns the clock value in the root time namespace. */
1362306a36Sopenharmony_ci	ktime_t	(*clock_get_ktime)(const clockid_t which_clock);
1462306a36Sopenharmony_ci	int	(*clock_adj)(const clockid_t which_clock, struct __kernel_timex *tx);
1562306a36Sopenharmony_ci	int	(*timer_create)(struct k_itimer *timer);
1662306a36Sopenharmony_ci	int	(*nsleep)(const clockid_t which_clock, int flags,
1762306a36Sopenharmony_ci			  const struct timespec64 *);
1862306a36Sopenharmony_ci	int	(*timer_set)(struct k_itimer *timr, int flags,
1962306a36Sopenharmony_ci			     struct itimerspec64 *new_setting,
2062306a36Sopenharmony_ci			     struct itimerspec64 *old_setting);
2162306a36Sopenharmony_ci	int	(*timer_del)(struct k_itimer *timr);
2262306a36Sopenharmony_ci	void	(*timer_get)(struct k_itimer *timr,
2362306a36Sopenharmony_ci			     struct itimerspec64 *cur_setting);
2462306a36Sopenharmony_ci	void	(*timer_rearm)(struct k_itimer *timr);
2562306a36Sopenharmony_ci	s64	(*timer_forward)(struct k_itimer *timr, ktime_t now);
2662306a36Sopenharmony_ci	ktime_t	(*timer_remaining)(struct k_itimer *timr, ktime_t now);
2762306a36Sopenharmony_ci	int	(*timer_try_to_cancel)(struct k_itimer *timr);
2862306a36Sopenharmony_ci	void	(*timer_arm)(struct k_itimer *timr, ktime_t expires,
2962306a36Sopenharmony_ci			     bool absolute, bool sigev_none);
3062306a36Sopenharmony_ci	void	(*timer_wait_running)(struct k_itimer *timr);
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciextern const struct k_clock clock_posix_cpu;
3462306a36Sopenharmony_ciextern const struct k_clock clock_posix_dynamic;
3562306a36Sopenharmony_ciextern const struct k_clock clock_process;
3662306a36Sopenharmony_ciextern const struct k_clock clock_thread;
3762306a36Sopenharmony_ciextern const struct k_clock alarm_clock;
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciint posix_timer_event(struct k_itimer *timr, int si_private);
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_civoid common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting);
4262306a36Sopenharmony_ciint common_timer_set(struct k_itimer *timr, int flags,
4362306a36Sopenharmony_ci		     struct itimerspec64 *new_setting,
4462306a36Sopenharmony_ci		     struct itimerspec64 *old_setting);
4562306a36Sopenharmony_ciint common_timer_del(struct k_itimer *timer);
46