~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/media/videobuf-dma-sg.h

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * helper functions for SG DMA video4linux capture buffers
  3  *
  4  * The functions expect the hardware being able to scatter gather
  5  * (i.e. the buffers are not linear in physical memory, but fragmented
  6  * into PAGE_SIZE chunks).  They also assume the driver does not need
  7  * to touch the video data.
  8  *
  9  * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org>
 10  *
 11  * Highly based on video-buf written originally by:
 12  * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
 13  * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org>
 14  * (c) 2006 Ted Walther and John Sokol
 15  *
 16  * This program is free software; you can redistribute it and/or modify
 17  * it under the terms of the GNU General Public License as published by
 18  * the Free Software Foundation; either version 2
 19  */
 20 #ifndef _VIDEOBUF_DMA_SG_H
 21 #define _VIDEOBUF_DMA_SG_H
 22 
 23 #include <media/videobuf-core.h>
 24 
 25 /* --------------------------------------------------------------------- */
 26 
 27 /*
 28  * A small set of helper functions to manage buffers (both userland
 29  * and kernel) for DMA.
 30  *
 31  * videobuf_dma_init_*()
 32  *      creates a buffer.  The userland version takes a userspace
 33  *      pointer + length.  The kernel version just wants the size and
 34  *      does memory allocation too using vmalloc_32().
 35  *
 36  * videobuf_dma_*()
 37  *      see Documentation/DMA-API-HOWTO.txt, these functions to
 38  *      basically the same.  The map function does also build a
 39  *      scatterlist for the buffer (and unmap frees it ...)
 40  *
 41  * videobuf_dma_free()
 42  *      no comment ...
 43  *
 44  */
 45 
 46 struct videobuf_dmabuf {
 47         u32                 magic;
 48 
 49         /* for userland buffer */
 50         int                 offset;
 51         size_t              size;
 52         struct page         **pages;
 53 
 54         /* for kernel buffers */
 55         void                *vaddr;
 56 
 57         /* for overlay buffers (pci-pci dma) */
 58         dma_addr_t          bus_addr;
 59 
 60         /* common */
 61         struct scatterlist  *sglist;
 62         int                 sglen;
 63         int                 nr_pages;
 64         int                 direction;
 65 };
 66 
 67 struct videobuf_dma_sg_memory {
 68         u32                 magic;
 69 
 70         /* for mmap'ed buffers */
 71         struct videobuf_dmabuf  dma;
 72 };
 73 
 74 /*
 75  * Scatter-gather DMA buffer API.
 76  *
 77  * These functions provide a simple way to create a page list and a
 78  * scatter-gather list from a kernel, userspace of physical address and map the
 79  * memory for DMA operation.
 80  *
 81  * Despite the name, this is totally unrelated to videobuf, except that
 82  * videobuf-dma-sg uses the same API internally.
 83  */
 84 void videobuf_dma_init(struct videobuf_dmabuf *dma);
 85 int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
 86                            unsigned long data, unsigned long size);
 87 int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
 88                              int nr_pages);
 89 int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
 90                               dma_addr_t addr, int nr_pages);
 91 int videobuf_dma_free(struct videobuf_dmabuf *dma);
 92 
 93 int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
 94 int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
 95 struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
 96 
 97 void *videobuf_sg_alloc(size_t size);
 98 
 99 void videobuf_queue_sg_init(struct videobuf_queue *q,
100                          const struct videobuf_queue_ops *ops,
101                          struct device *dev,
102                          spinlock_t *irqlock,
103                          enum v4l2_buf_type type,
104                          enum v4l2_field field,
105                          unsigned int msize,
106                          void *priv,
107                          struct mutex *ext_lock);
108 
109 #endif /* _VIDEOBUF_DMA_SG_H */
110 
111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp