diff options
author | Rob Clark <rob@ti.com> | 2010-06-01 13:36:22 -0500 |
---|---|---|
committer | Sebastien Jan <s-jan@ti.com> | 2010-07-20 10:49:26 +0200 |
commit | 9403bbd2cd2e128bfd944c1cf2c4235645e0238b (patch) | |
tree | a9d50b81c7eebead638c96481166ff294c932be0 /include | |
parent | 13081f804447dfea57b99d0779ebd05c5059c154 (diff) |
add timer32 driver interface for userspace
The 32ksync counter is useful to use for timestamping, and for other cases
where an aligned timestamp across the various cores on OMAP is required.
Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/timer-32k.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/timer-32k.h b/include/linux/timer-32k.h new file mode 100644 index 000000000000..aaae2ec3584a --- /dev/null +++ b/include/linux/timer-32k.h @@ -0,0 +1,44 @@ +/* + * OMAP2/3/4 timer32k driver interface + * + * Copyright (C) 2010 Texas Instruments, Inc + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#ifndef __LINUX_TIMER_32_H__ +#define __LINUX_TIMER_32_H__ + +#include <linux/ioctl.h> +#define OMAP_32K_READ _IOWR('t', 0, uint32_t) +#define OMAP_32K_READRAW _IOWR('t', 1, uint32_t) + +#ifndef __KERNEL__ +static inline uint32_t __omap_32k_call(int nr) +{ + static int fd = 0; + if (!fd) { + fd = open("/dev/timer32k", 0); + } + if (fd) { + uint32_t t; + if (ioctl(fd, nr, &t) >= 0) { + return t; + } + } + return 0; +} +static inline uint32_t omap_32k_read(void) +{ + return __omap_32k_call(OMAP_32K_READ); +} +static inline uint32_t omap_32k_readraw(void) +{ + return __omap_32k_call(OMAP_32K_READRAW); +} +#endif + +#endif /* __LINUX_TIMER_32_H__ */ + |