0001 #ifndef __NVIF_TIMER_H__
0002 #define __NVIF_TIMER_H__
0003 #include <nvif/os.h>
0004
0005 struct nvif_timer_wait {
0006 struct nvif_device *device;
0007 u64 limit;
0008 u64 time0;
0009 u64 time1;
0010 int reads;
0011 };
0012
0013 void nvif_timer_wait_init(struct nvif_device *, u64 nsec,
0014 struct nvif_timer_wait *);
0015 s64 nvif_timer_wait_test(struct nvif_timer_wait *);
0016
0017
0018
0019
0020
0021
0022 #define nvif_nsec(d,n,cond...) ({ \
0023 struct nvif_timer_wait _wait; \
0024 s64 _taken = 0; \
0025 \
0026 nvif_timer_wait_init((d), (n), &_wait); \
0027 do { \
0028 cond \
0029 } while ((_taken = nvif_timer_wait_test(&_wait)) >= 0); \
0030 \
0031 _taken; \
0032 })
0033 #define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond)
0034 #define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond)
0035 #endif