Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
timer.h
Go to the documentation of this file.
1 #ifndef __NOUVEAU_TIMER_H__
2 #define __NOUVEAU_TIMER_H__
3 
4 #include <core/subdev.h>
5 #include <core/device.h>
6 
7 struct nouveau_alarm {
8  struct list_head head;
10  void (*func)(struct nouveau_alarm *);
11 };
12 
15 bool nouveau_timer_wait_cb(void *, u64 nsec, bool (*func)(void *), void *data);
16 void nouveau_timer_alarm(void *, u32 nsec, struct nouveau_alarm *);
17 
18 #define NV_WAIT_DEFAULT 2000000000ULL
19 #define nv_wait(o,a,m,v) \
20  nouveau_timer_wait_eq((o), NV_WAIT_DEFAULT, (a), (m), (v))
21 #define nv_wait_ne(o,a,m,v) \
22  nouveau_timer_wait_ne((o), NV_WAIT_DEFAULT, (a), (m), (v))
23 #define nv_wait_cb(o,c,d) \
24  nouveau_timer_wait_cb((o), NV_WAIT_DEFAULT, (c), (d))
25 
26 struct nouveau_timer {
28  u64 (*read)(struct nouveau_timer *);
29  void (*alarm)(struct nouveau_timer *, u64 time, struct nouveau_alarm *);
30 };
31 
32 static inline struct nouveau_timer *
33 nouveau_timer(void *obj)
34 {
35  return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_TIMER];
36 }
37 
38 #define nouveau_timer_create(p,e,o,d) \
39  nouveau_subdev_create_((p), (e), (o), 0, "PTIMER", "timer", \
40  sizeof(**d), (void **)d)
41 #define nouveau_timer_destroy(p) \
42  nouveau_subdev_destroy(&(p)->base)
43 #define nouveau_timer_init(p) \
44  nouveau_subdev_init(&(p)->base)
45 #define nouveau_timer_fini(p,s) \
46  nouveau_subdev_fini(&(p)->base, (s))
47 
49  struct nouveau_oclass *, int size, void **);
50 
51 extern struct nouveau_oclass nv04_timer_oclass;
52 
53 #endif