diff options
author | Russell King <rmk+cubox@arm.linux.org.uk> | 2013-12-08 21:29:56 +0000 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2013-12-08 22:02:42 +0000 |
commit | 6f2e8ec4c736fbffe3d0e0f1ec07f453910441a1 (patch) | |
tree | 3adfc685d5addab0a3d7a609a0d620b0046a6bee /bmm_drv.h | |
parent | dcad449e26e81b71e4a498dc5bfaf014a5566acd (diff) |
This is a complete redesign and rewrite of libbmm. This implementation
is based upon dma_bufs - where a dma_buf is a kernel-side buffer which
can be passed to and from other subsystems. libbmm becomes a provider
of dma_bufs - it permits userspace to allocate such things.
When a dma_buf is allocated, userspace is handed a file descriptor
which is unique to this buffer. This file descriptor can then be
passed into other subsystems, which can then request access to this
buffer.
The file descriptor supports very few operations - it can be mmap()d to
provide userspace access to the buffer, and it can be closed when it is
no longer required. Internally in the kernel, dma_bufs are reference
counted, so the dma_buf will only be freed when the last user gives up
its reference.
Diffstat (limited to 'bmm_drv.h')
-rw-r--r-- | bmm_drv.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bmm_drv.h b/bmm_drv.h new file mode 100644 index 0000000..77855d4 --- /dev/null +++ b/bmm_drv.h @@ -0,0 +1,42 @@ +/* + * bmm_drv.h + * + * Copyright (C) 2013 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, you can distribute this file under the GNU Lesser + * General Public License version 2.1 as published by the Free Software + * Foundation. + */ +#ifndef __BMM_DRV_H__ +#define __BMM_DRV_H__ + +#include <stdint.h> + +#define BMM_DEVICE_FILE "/dev/bmm" +#define BMM_MINOR 94 + +/* ioctl commands */ +struct bmm_dmabuf_alloc { + uint64_t size; + uint64_t align; + uint32_t attr; + int32_t fd; +}; + +struct bmm_dmabuf_flush { + uint64_t size; + uint64_t offset; + uint64_t ptr; + int32_t fd; + uint32_t direction; +}; + +#define BMEM_IOCTL_MAGIC 'G' +#define BMM_DMABUF_ALLOC _IOWR(BMEM_IOCTL_MAGIC, 64, struct bmm_dmabuf_alloc) +#define BMM_DMABUF_FLUSH _IOW(BMEM_IOCTL_MAGIC, 65, struct bmm_dmabuf_flush) + +#endif /* __BMM_DRV_H__ */ |