[media] media: remove emacs editor variables
[deliverable/linux.git] / drivers / media / usb / pvrusb2 / pvrusb2-io.h
CommitLineData
d855497e
MI
1/*
2 *
d855497e
MI
3 *
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20#ifndef __PVRUSB2_IO_H
21#define __PVRUSB2_IO_H
22
23#include <linux/usb.h>
24#include <linux/list.h>
25
26typedef void (*pvr2_stream_callback)(void *);
27
28enum pvr2_buffer_state {
29 pvr2_buffer_state_none = 0, // Not on any list
30 pvr2_buffer_state_idle = 1, // Buffer is ready to be used again
31 pvr2_buffer_state_queued = 2, // Buffer has been queued for filling
32 pvr2_buffer_state_ready = 3, // Buffer has data available
33};
34
35struct pvr2_stream;
36struct pvr2_buffer;
37
ad0992e9
MI
38struct pvr2_stream_stats {
39 unsigned int buffers_in_queue;
40 unsigned int buffers_in_idle;
41 unsigned int buffers_in_ready;
42 unsigned int buffers_processed;
43 unsigned int buffers_failed;
44 unsigned int bytes_processed;
45};
46
d855497e
MI
47/* Initialize / tear down stream structure */
48struct pvr2_stream *pvr2_stream_create(void);
49void pvr2_stream_destroy(struct pvr2_stream *);
50void pvr2_stream_setup(struct pvr2_stream *,
51 struct usb_device *dev,int endpoint,
52 unsigned int tolerance);
53void pvr2_stream_set_callback(struct pvr2_stream *,
54 pvr2_stream_callback func,
55 void *data);
ad0992e9
MI
56void pvr2_stream_get_stats(struct pvr2_stream *,
57 struct pvr2_stream_stats *,
58 int zero_counts);
d855497e
MI
59
60/* Query / set the nominal buffer count */
e61b6fc5 61int pvr2_stream_get_buffer_count(struct pvr2_stream *);
d855497e
MI
62int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int);
63
64/* Get a pointer to a buffer that is either idle, ready, or is specified
65 named. */
66struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *);
67struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *);
68struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id);
69
70/* Find out how many buffers are idle or ready */
d855497e
MI
71int pvr2_stream_get_ready_count(struct pvr2_stream *);
72
e61b6fc5 73
d855497e
MI
74/* Kill all pending buffers and throw away any ready buffers as well */
75void pvr2_stream_kill(struct pvr2_stream *);
76
77/* Set up the actual storage for a buffer */
78int pvr2_buffer_set_buffer(struct pvr2_buffer *,void *ptr,unsigned int cnt);
79
80/* Find out size of data in the given ready buffer */
81unsigned int pvr2_buffer_get_count(struct pvr2_buffer *);
82
83/* Retrieve completion code for given ready buffer */
84int pvr2_buffer_get_status(struct pvr2_buffer *);
85
d855497e
MI
86/* Retrieve ID of given buffer */
87int pvr2_buffer_get_id(struct pvr2_buffer *);
88
89/* Start reading into given buffer (kill it if needed) */
90int pvr2_buffer_queue(struct pvr2_buffer *);
91
d855497e 92#endif /* __PVRUSB2_IO_H */
This page took 0.78461 seconds and 5 git commands to generate.