111838SLiane.Praza@Sun.COM/*	$NetBSD: hrtimer.h,v 1.7 2021/12/19 11:55:47 riastradh Exp $	*/
211838SLiane.Praza@Sun.COM
311838SLiane.Praza@Sun.COM/*-
411838SLiane.Praza@Sun.COM * Copyright (c) 2014 The NetBSD Foundation, Inc.
511838SLiane.Praza@Sun.COM * All rights reserved.
611838SLiane.Praza@Sun.COM *
711838SLiane.Praza@Sun.COM * This code is derived from software contributed to The NetBSD Foundation
811838SLiane.Praza@Sun.COM * by Taylor R. Campbell.
911838SLiane.Praza@Sun.COM *
1011838SLiane.Praza@Sun.COM * Redistribution and use in source and binary forms, with or without
1111838SLiane.Praza@Sun.COM * modification, are permitted provided that the following conditions
1211838SLiane.Praza@Sun.COM * are met:
1311838SLiane.Praza@Sun.COM * 1. Redistributions of source code must retain the above copyright
1411838SLiane.Praza@Sun.COM *    notice, this list of conditions and the following disclaimer.
1511838SLiane.Praza@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright
1611838SLiane.Praza@Sun.COM *    notice, this list of conditions and the following disclaimer in the
1711838SLiane.Praza@Sun.COM *    documentation and/or other materials provided with the distribution.
1811838SLiane.Praza@Sun.COM *
1911838SLiane.Praza@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2011838SLiane.Praza@Sun.COM * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2111838SLiane.Praza@Sun.COM * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2211838SLiane.Praza@Sun.COM * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2312616Sdp@eng.sun.com * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2411838SLiane.Praza@Sun.COM * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2511838SLiane.Praza@Sun.COM * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2611838SLiane.Praza@Sun.COM * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2711838SLiane.Praza@Sun.COM * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2811838SLiane.Praza@Sun.COM * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2912616Sdp@eng.sun.com * POSSIBILITY OF SUCH DAMAGE.
3012616Sdp@eng.sun.com */
3111838SLiane.Praza@Sun.COM
3211838SLiane.Praza@Sun.COM#ifndef _LINUX_HRTIMER_H_
3311838SLiane.Praza@Sun.COM#define _LINUX_HRTIMER_H_
3412616Sdp@eng.sun.com
3512616Sdp@eng.sun.com#include <sys/types.h>
3612616Sdp@eng.sun.com
3712616Sdp@eng.sun.com#include <sys/callout.h>
3812616Sdp@eng.sun.com
3911838SLiane.Praza@Sun.COM#include <linux/ktime.h>
4011838SLiane.Praza@Sun.COM#include <linux/timer.h>
4111838SLiane.Praza@Sun.COM
4211838SLiane.Praza@Sun.COMenum hrtimer_mode {
4311838SLiane.Praza@Sun.COM	HRTIMER_MODE_ABS,
4411838SLiane.Praza@Sun.COM	HRTIMER_MODE_REL,
4511838SLiane.Praza@Sun.COM	HRTIMER_MODE_REL_PINNED,
4611838SLiane.Praza@Sun.COM};
4711838SLiane.Praza@Sun.COM
4811838SLiane.Praza@Sun.COMstruct hrtimer {
4911838SLiane.Praza@Sun.COM	enum hrtimer_restart (*function)(struct hrtimer *);
5011838SLiane.Praza@Sun.COM
5111838SLiane.Praza@Sun.COM	struct callout		hrt_ch;
5211838SLiane.Praza@Sun.COM	enum hrtimer_mode	hrt_mode;
5311838SLiane.Praza@Sun.COM	ktime_t			hrt_expires;
5411838SLiane.Praza@Sun.COM};
5512616Sdp@eng.sun.com
5612616Sdp@eng.sun.comenum hrtimer_restart {
5712616Sdp@eng.sun.com	HRTIMER_NORESTART,
5812616Sdp@eng.sun.com	HRTIMER_RESTART,
5912616Sdp@eng.sun.com};
6012616Sdp@eng.sun.com
6112616Sdp@eng.sun.com#define	hrtimer_active		linux_hrtimer_active
6211838SLiane.Praza@Sun.COM#define	hrtimer_add_expires_ns	linux_hrtimer_add_expires_ns
6311838SLiane.Praza@Sun.COM#define	hrtimer_cancel		linux_hrtimer_cancel
6411838SLiane.Praza@Sun.COM#define	hrtimer_forward		linux_hrtimer_forward
6511838SLiane.Praza@Sun.COM#define	hrtimer_forward_now	linux_hrtimer_forward_now
6611838SLiane.Praza@Sun.COM#define	hrtimer_init		linux_hrtimer_init
6711838SLiane.Praza@Sun.COM#define	hrtimer_set_expires	linux_hrtimer_set_expiresp
6811838SLiane.Praza@Sun.COM#define	hrtimer_start		linux_hrtimer_start
6911838SLiane.Praza@Sun.COM#define	hrtimer_start_range_ns	linux_hrtimer_start_range_ns
7011838SLiane.Praza@Sun.COM
7111838SLiane.Praza@Sun.COMvoid hrtimer_init(struct hrtimer *, clockid_t, enum hrtimer_mode);
7211838SLiane.Praza@Sun.COMvoid hrtimer_set_expires(struct hrtimer *, ktime_t);
7311838SLiane.Praza@Sun.COMvoid hrtimer_add_expires_ns(struct hrtimer *, uint64_t);
7411838SLiane.Praza@Sun.COMvoid hrtimer_start(struct hrtimer *, ktime_t, enum hrtimer_mode);
7511838SLiane.Praza@Sun.COMvoid hrtimer_start_range_ns(struct hrtimer *, ktime_t, uint64_t,
7611838SLiane.Praza@Sun.COM    enum hrtimer_mode);
7711838SLiane.Praza@Sun.COMint hrtimer_cancel(struct hrtimer *);
7811838SLiane.Praza@Sun.COMbool hrtimer_active(struct hrtimer *);
7911838SLiane.Praza@Sun.COMuint64_t hrtimer_forward(struct hrtimer *, ktime_t, ktime_t);
8011838SLiane.Praza@Sun.COMuint64_t hrtimer_forward_now(struct hrtimer *, ktime_t);
8113057SPeter.Dennis@Oracle.COM
8213057SPeter.Dennis@Oracle.COM#endif  /* _LINUX_HRTIMER_H_ */
8313057SPeter.Dennis@Oracle.COM