Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
videobuf2-memops.c File Reference
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/file.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-memops.h>

Go to the source code of this file.

Functions

struct vm_area_structvb2_get_vma (struct vm_area_struct *vma)
 
 EXPORT_SYMBOL_GPL (vb2_get_vma)
 
void vb2_put_vma (struct vm_area_struct *vma)
 
 EXPORT_SYMBOL_GPL (vb2_put_vma)
 
int vb2_get_contig_userptr (unsigned long vaddr, unsigned long size, struct vm_area_struct **res_vma, dma_addr_t *res_pa)
 
 EXPORT_SYMBOL_GPL (vb2_get_contig_userptr)
 
int vb2_mmap_pfn_range (struct vm_area_struct *vma, unsigned long paddr, unsigned long size, const struct vm_operations_struct *vm_ops, void *priv)
 
 EXPORT_SYMBOL_GPL (vb2_mmap_pfn_range)
 
 EXPORT_SYMBOL_GPL (vb2_common_vm_ops)
 
 MODULE_DESCRIPTION ("common memory handling routines for videobuf2")
 
 MODULE_AUTHOR ("Pawel Osciak <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 

Variables

struct vm_operations_struct vb2_common_vm_ops
 

Function Documentation

EXPORT_SYMBOL_GPL ( vb2_get_vma  )
EXPORT_SYMBOL_GPL ( vb2_put_vma  )
EXPORT_SYMBOL_GPL ( vb2_get_contig_userptr  )
EXPORT_SYMBOL_GPL ( vb2_mmap_pfn_range  )
EXPORT_SYMBOL_GPL ( vb2_common_vm_ops  )
MODULE_AUTHOR ( "Pawel Osciak <[email protected]>"  )
MODULE_DESCRIPTION ( "common memory handling routines for videobuf2"  )
MODULE_LICENSE ( "GPL"  )
int vb2_get_contig_userptr ( unsigned long  vaddr,
unsigned long  size,
struct vm_area_struct **  res_vma,
dma_addr_t res_pa 
)

vb2_get_contig_userptr() - lock physically contiguous userspace mapped memory : starting virtual address of the area to be verified : size of the area : will return physical address for the given vaddr : will return locked copy of struct vm_area for the given area

This function will go through memory area of size mapped at and verify that the underlying physical pages are contiguous. If they are contiguous the virtual memory area is locked and a is filled with the copy and set to the physical address of the buffer.

Returns 0 on success.

Definition at line 96 of file videobuf2-memops.c.

struct vm_area_struct* vb2_get_vma ( struct vm_area_struct vma)
read

vb2_get_vma() - acquire and lock the virtual memory area : given virtual memory area

This function attempts to acquire an area mapped in the userspace for the duration of a hardware operation. The area is "locked" by performing the same set of operation that are done when process calls fork() and memory areas are duplicated.

Returns a copy of a virtual memory region on success or NULL.

Definition at line 36 of file videobuf2-memops.c.

int vb2_mmap_pfn_range ( struct vm_area_struct vma,
unsigned long  paddr,
unsigned long  size,
const struct vm_operations_struct *  vm_ops,
void priv 
)

vb2_mmap_pfn_range() - map physical pages to userspace : virtual memory region for the mapping : starting physical address of the memory to be mapped : size of the memory to be mapped : vm operations to be assigned to the created area : private data to be associated with the area

Returns 0 on success.

Definition at line 149 of file videobuf2-memops.c.

void vb2_put_vma ( struct vm_area_struct vma)

vb2_put_userptr() - release a userspace virtual memory area : virtual memory region associated with the area to be released

This function releases the previously acquired memory area after a hardware operation.

Definition at line 67 of file videobuf2-memops.c.

Variable Documentation

struct vm_operations_struct vb2_common_vm_ops
Initial value:
= {
.open = vb2_common_vm_open,
.close = vb2_common_vm_close,
}

vb2_common_vm_ops - common vm_ops used for tracking refcount of mmaped video buffers

Definition at line 219 of file videobuf2-memops.c.