summaryrefslogtreecommitdiff
path: root/linux/include
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-07-16 23:33:39 +0200
committerMagnus Damm <magnus.damm@gmail.com>2008-07-16 23:33:39 +0200
commit2bddd0c00ca2ada3437d201131eaf36cde36f653 (patch)
tree62c578ca332b61b507e26de5413d3d24fb040684 /linux/include
parent6318b8e2155854a28a9f6c00319d20006f14d97e (diff)
downloadmediapointer-dvb-s2-2bddd0c00ca2ada3437d201131eaf36cde36f653.tar.gz
mediapointer-dvb-s2-2bddd0c00ca2ada3437d201131eaf36cde36f653.tar.bz2
videobuf: Add physically contiguous queue code V3
This is V3 of the physically contiguous videobuf queues patch. Useful for hardware such as the SuperH Mobile CEU which doesn't support scatter gatter bus mastering. Since it may be difficult to allocate large chunks of physically contiguous memory after some uptime due to fragmentation, this code allocates memory using dma_alloc_coherent(). Architectures supporting dma_declare_coherent_memory() can easily avoid fragmentation issues by using dma_declare_coherent_memory() to force dma_alloc_coherent() to allocate from a certain pre-allocated memory area. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> --- Changes since V2 - use dma_handle for physical address - use "scatter gather" instead of "scatter gatter" Changes since V1: - use dev_err() instead of pr_err() - remember size in struct videobuf_dma_contig_memory - keep struct videobuf_dma_contig_memory in .c file - let videobuf_to_dma_contig() return dma_addr_t - implement __videobuf_sync() - return statements, white space and other minor fixes drivers/media/video/Kconfig | 5 drivers/media/video/Makefile | 1 drivers/media/video/videobuf-dma-contig.c | 417 +++++++++++++++++++++++++++++ include/media/videobuf-dma-contig.h | 32 ++ 4 files changed, 455 insertions(+)
Diffstat (limited to 'linux/include')
-rw-r--r--linux/include/media/videobuf-dma-contig.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/linux/include/media/videobuf-dma-contig.h b/linux/include/media/videobuf-dma-contig.h
new file mode 100644
index 000000000..549386681
--- /dev/null
+++ b/linux/include/media/videobuf-dma-contig.h
@@ -0,0 +1,32 @@
+/*
+ * helper functions for physically contiguous capture buffers
+ *
+ * The functions support hardware lacking scatter gather support
+ * (i.e. the buffers must be linear in physical memory)
+ *
+ * Copyright (c) 2008 Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2
+ */
+#ifndef _VIDEOBUF_DMA_CONTIG_H
+#define _VIDEOBUF_DMA_CONTIG_H
+
+#include <linux/dma-mapping.h>
+#include <media/videobuf-core.h>
+
+void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
+ struct videobuf_queue_ops *ops,
+ struct device *dev,
+ spinlock_t *irqlock,
+ enum v4l2_buf_type type,
+ enum v4l2_field field,
+ unsigned int msize,
+ void *priv);
+
+dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
+void videobuf_dma_contig_free(struct videobuf_queue *q,
+ struct videobuf_buffer *buf);
+
+#endif /* _VIDEOBUF_DMA_CONTIG_H */