summaryrefslogtreecommitdiff
path: root/bmm_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'bmm_lib.c')
-rw-r--r--bmm_lib.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/bmm_lib.c b/bmm_lib.c
index f9d8e69..1b3a156 100644
--- a/bmm_lib.c
+++ b/bmm_lib.c
@@ -34,6 +34,7 @@
#define API_COMP_MAX 0x0000
#define API_FEAT(x) ((x) >> 16)
#define API_COMP(x) ((x) & 0xffff)
+#define API_FEAT_GET_DMABUF_FD 0x0001
static unsigned bmm_api;
static int bmm_fd = -1;
@@ -207,6 +208,23 @@ unsigned long bmm_get_paddr(void *vaddr)
return io.output;
}
+int bmm_get_dmabuf_fd(void *vaddr)
+{
+ int ret;
+ ioctl_arg_t io;
+
+ if (bmm_init() < 0 || API_FEAT(bmm_api) < API_FEAT_GET_DMABUF_FD)
+ return -1;
+
+ io.input = (unsigned long)vaddr;
+ io.output = 0;
+ io.arg = 0;
+
+ ret = ioctl(bmm_fd, BMM_GET_DMABUF_FD, &io);
+
+ return ret < 0 ? -1 : io.output;
+}
+
unsigned long bmm_get_mem_size(void *vaddr)
{
int ret;