Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ispqueue.c File Reference
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/scatterlist.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "ispqueue.h"

Go to the source code of this file.

Macros

#define ISP_CACHE_FLUSH_PAGES_MAX   0
 

Functions

int omap3isp_video_queue_cleanup (struct isp_video_queue *queue)
 
int omap3isp_video_queue_init (struct isp_video_queue *queue, enum v4l2_buf_type type, const struct isp_video_queue_operations *ops, struct device *dev, unsigned int bufsize)
 
int omap3isp_video_queue_reqbufs (struct isp_video_queue *queue, struct v4l2_requestbuffers *rb)
 
int omap3isp_video_queue_querybuf (struct isp_video_queue *queue, struct v4l2_buffer *vbuf)
 
int omap3isp_video_queue_qbuf (struct isp_video_queue *queue, struct v4l2_buffer *vbuf)
 
int omap3isp_video_queue_dqbuf (struct isp_video_queue *queue, struct v4l2_buffer *vbuf, int nonblocking)
 
int omap3isp_video_queue_streamon (struct isp_video_queue *queue)
 
void omap3isp_video_queue_streamoff (struct isp_video_queue *queue)
 
void omap3isp_video_queue_discard_done (struct isp_video_queue *queue)
 
int omap3isp_video_queue_mmap (struct isp_video_queue *queue, struct vm_area_struct *vma)
 
unsigned int omap3isp_video_queue_poll (struct isp_video_queue *queue, struct file *file, poll_table *wait)
 

Macro Definition Documentation

#define ISP_CACHE_FLUSH_PAGES_MAX   0

Definition at line 65 of file ispqueue.c.

Function Documentation

int omap3isp_video_queue_cleanup ( struct isp_video_queue queue)

omap3isp_video_queue_cleanup - Clean up the video buffers queue : Video buffers queue

Free all allocated resources and clean up the video buffers queue. The queue must not be busy (no ongoing video stream) and buffers must have been unmapped.

Return 0 on success or -EBUSY if the queue is busy or buffers haven't been unmapped.

Definition at line 704 of file ispqueue.c.

void omap3isp_video_queue_discard_done ( struct isp_video_queue queue)

omap3isp_video_queue_discard_done - Discard all buffers marked as DONE

This function is intended to be used with suspend/resume operations. It discards all 'done' buffers as they would be too old to be requested after resume.

Drivers must stop the hardware and synchronize with interrupt handlers and/or delayed works before calling this function to make sure no buffer will be touched by the driver and/or hardware.

Definition at line 1034 of file ispqueue.c.

int omap3isp_video_queue_dqbuf ( struct isp_video_queue queue,
struct v4l2_buffer vbuf,
int  nonblocking 
)

omap3isp_video_queue_dqbuf - Dequeue a buffer

This function is intended to be used as a VIDIOC_DQBUF ioctl handler.

Wait until a buffer is ready to be dequeued, remove it from the queue and copy its information to the v4l2_buffer structure.

If the nonblocking argument is not zero and no buffer is ready, return -EAGAIN immediately instead of waiting.

If no buffer has been enqueued, or if the requested buffer type doesn't match the queue type, return -EINVAL.

Definition at line 920 of file ispqueue.c.

int omap3isp_video_queue_init ( struct isp_video_queue queue,
enum v4l2_buf_type  type,
const struct isp_video_queue_operations ops,
struct device dev,
unsigned int  bufsize 
)

omap3isp_video_queue_init - Initialize the video buffers queue : Video buffers queue : V4L2 buffer type (capture or output) : Driver-specific queue operations : Device used for DMA operations : Size of the driver-specific buffer structure

Initialize the video buffers queue with the supplied parameters.

The queue type must be one of V4L2_BUF_TYPE_VIDEO_CAPTURE or V4L2_BUF_TYPE_VIDEO_OUTPUT. Other buffer types are not supported yet.

Buffer objects will be allocated using the given buffer size to allow room for driver-specific fields. Driver-specific buffer structures must start with a struct isp_video_buffer field. Drivers with no driver-specific buffer structure must pass the size of the isp_video_buffer structure in the bufsize parameter.

Return 0 on success.

Definition at line 730 of file ispqueue.c.

int omap3isp_video_queue_mmap ( struct isp_video_queue queue,
struct vm_area_struct vma 
)

omap3isp_video_queue_mmap - Map buffers to userspace

This function is intended to be used as an mmap() file operation handler. It maps a buffer to userspace based on the VMA offset.

Only buffers of memory type MMAP are supported.

Definition at line 1082 of file ispqueue.c.

unsigned int omap3isp_video_queue_poll ( struct isp_video_queue queue,
struct file file,
poll_table wait 
)

omap3isp_video_queue_poll - Poll video queue state

This function is intended to be used as a poll() file operation handler. It polls the state of the video buffer at the front of the queue and returns an events mask.

If no buffer is present at the front of the queue, POLLERR is returned.

Definition at line 1133 of file ispqueue.c.

int omap3isp_video_queue_qbuf ( struct isp_video_queue queue,
struct v4l2_buffer vbuf 
)

omap3isp_video_queue_qbuf - Queue a buffer

This function is intended to be used as a VIDIOC_QBUF ioctl handler.

The v4l2_buffer structure passed from userspace is first sanity tested. If sane, the buffer is then processed and added to the main queue and, if the queue is streaming, to the IRQ queue.

Before being enqueued, USERPTR buffers are checked for address changes. If the buffer has a different userspace address, the old memory area is unlocked and the new memory area is locked.

Definition at line 847 of file ispqueue.c.

int omap3isp_video_queue_querybuf ( struct isp_video_queue queue,
struct v4l2_buffer vbuf 
)

omap3isp_video_queue_querybuf - Query the status of a buffer in a queue

This function is intended to be used as a VIDIOC_QUERYBUF ioctl handler. It returns the status of a given video buffer.

Return 0 on success or -EINVAL if the buffer type or index are invalid.

Definition at line 810 of file ispqueue.c.

int omap3isp_video_queue_reqbufs ( struct isp_video_queue queue,
struct v4l2_requestbuffers rb 
)

omap3isp_video_queue_reqbufs - Allocate video buffers memory

This function is intended to be used as a VIDIOC_REQBUFS ioctl handler. It allocated video buffer objects and, for MMAP buffers, buffer memory.

If the number of buffers is 0, all buffers are freed and the function returns without performing any allocation.

If the number of buffers is not 0, currently allocated buffers (if any) are freed and the requested number of buffers are allocated. Depending on driver-specific requirements and on memory availability, a number of buffer smaller or bigger than requested can be allocated. This isn't considered as an error.

Return 0 on success or one of the following error codes:

-EINVAL if the buffer type or index are invalid -EBUSY if the queue is busy (streaming or buffers mapped) -ENOMEM if the buffers can't be allocated due to an out-of-memory condition

Definition at line 772 of file ispqueue.c.

void omap3isp_video_queue_streamoff ( struct isp_video_queue queue)

omap3isp_video_queue_streamoff - Stop streaming

This function is intended to be used as a VIDIOC_STREAMOFF ioctl handler. It stops streaming on the queue and wakes up all the buffers.

Drivers must stop the hardware and synchronize with interrupt handlers and/or delayed works before calling this function to make sure no buffer will be touched by the driver and/or hardware.

Definition at line 993 of file ispqueue.c.

int omap3isp_video_queue_streamon ( struct isp_video_queue queue)

omap3isp_video_queue_streamon - Start streaming

This function is intended to be used as a VIDIOC_STREAMON ioctl handler. It starts streaming on the queue and calls the buffer_queue operation for all queued buffers.

Return 0 on success.

Definition at line 961 of file ispqueue.c.