xref: /gfx-drm/usr/src/uts/common/drm/drm_sun_timer.h (revision 47dc10d7)
1 /*
2  * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 /*
25  * Copyright (c) 2012 Intel Corporation.  All rights reserved.
26  */
27 
28 #ifndef __DRM_TIMER_H__
29 #define __DRM_TIMER_H__
30 
31 #include <sys/types.h>
32 #include <sys/conf.h>
33 #include <sys/ksynch.h>
34 #include "drm_linux_list.h"
35 #include "drm_linux.h"
36 
37 #define del_timer_sync del_timer
38 
39 struct timer_list {
40 	struct list_head *head;
41 	void (*func)(void *);
42 	void *arg;
43 	clock_t expires;
44 	unsigned long expired_time;
45 	timeout_id_t timer_id;
46 	kmutex_t lock;
47 };
48 
49 extern void init_timer(struct timer_list *timer);
50 extern void destroy_timer(struct timer_list *timer);
51 extern void setup_timer(struct timer_list *timer, void (*func)(void *), void *arg);
52 extern void mod_timer(struct timer_list *timer, clock_t expires);
53 extern void del_timer(struct timer_list *timer);
54 extern void test_set_timer(struct timer_list *timer, clock_t expires);
55 
56 #endif /* __DRM_TIMER_H__ */
57