summaryrefslogtreecommitdiff
blob: 2851032e7aeb92f00632196589acf19cd8db12ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From 1c2c1413e6777865c037ba3d849da69cf9342b0a Mon Sep 17 00:00:00 2001
From: Daniel Diaz <ddiaz@ti.com>
Date: Thu, 20 Jan 2011 16:21:18 -0600
Subject: [PATCH] Temporary patch to access OMAP 32K timer (not yet exported by the kernel)

Signed-off-by: Daniel Diaz <ddiaz@ti.com>
---
 omx/gstomx_camera.c |    2 +-
 omx/timer-32k.h     |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletions(-)
 create mode 100644 omx/timer-32k.h

diff --git a/omx/gstomx_camera.c b/omx/gstomx_camera.c
index 8e3983e..eb101fd 100644
--- a/omx/gstomx_camera.c
+++ b/omx/gstomx_camera.c
@@ -34,7 +34,7 @@
 #include <stdint.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <linux/timer-32k.h>
+#include "timer-32k.h"
 
 /**
  * SECTION:element-omx_camerasrc
diff --git a/omx/timer-32k.h b/omx/timer-32k.h
new file mode 100644
index 0000000..98fc2dc
--- /dev/null
+++ b/omx/timer-32k.h
@@ -0,0 +1,48 @@
+/*
+ * 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__
+
+#include <stdint.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+static inline uint32_t __omap_32k_call(int nr)
+{
+	static int fd;
+	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__ */
+
-- 
1.7.3.4