blob: 745e270233c26572f2c8f647ae64b43b24908268 [file] [log] [blame]
Mike Iselyd8554972006-06-26 20:58:46 -03001/*
2 * $Id$
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_BASE_H
21#define __PVRUSB2_BASE_H
22
23#include <linux/mutex.h>
24#include <linux/usb.h>
25#include <linux/workqueue.h>
26
27struct pvr2_hdw; /* hardware interface - defined elsewhere */
28struct pvr2_stream; /* stream interface - defined elsewhere */
29
30struct pvr2_context; /* All central state */
31struct pvr2_channel; /* One I/O pathway to a user */
32struct pvr2_context_stream; /* Wrapper for a stream */
Mike Iselyd8554972006-06-26 20:58:46 -030033struct pvr2_ioread; /* Low level stream structure */
34
35struct pvr2_context_stream {
36 struct pvr2_channel *user;
37 struct pvr2_stream *stream;
38};
39
40struct pvr2_context {
41 struct pvr2_channel *mc_first;
42 struct pvr2_channel *mc_last;
Mike Iselye5be15c2008-04-07 02:22:04 -030043 struct pvr2_context *exist_next;
44 struct pvr2_context *exist_prev;
45 struct pvr2_context *notify_next;
46 struct pvr2_context *notify_prev;
Mike Iselyd8554972006-06-26 20:58:46 -030047 struct pvr2_hdw *hdw;
48 struct pvr2_context_stream video_stream;
49 struct mutex mutex;
Mike Isely794b1602008-04-22 14:45:45 -030050 int notify_flag;
Mike Iselye5be15c2008-04-07 02:22:04 -030051 int initialized_flag;
Mike Iselyd8554972006-06-26 20:58:46 -030052 int disconnect_flag;
Mike Isely794b1602008-04-22 14:45:45 -030053
Mike Iselyd8554972006-06-26 20:58:46 -030054 /* Called after pvr2_context initialization is complete */
55 void (*setup_func)(struct pvr2_context *);
56
Mike Iselyd8554972006-06-26 20:58:46 -030057};
58
59struct pvr2_channel {
60 struct pvr2_context *mc_head;
61 struct pvr2_channel *mc_next;
62 struct pvr2_channel *mc_prev;
63 struct pvr2_context_stream *stream;
64 struct pvr2_hdw *hdw;
Mike Isely1cb03b72008-04-21 03:47:43 -030065 unsigned int input_mask;
Mike Iselyd8554972006-06-26 20:58:46 -030066 void (*check_func)(struct pvr2_channel *);
67};
68
Mike Iselyd8554972006-06-26 20:58:46 -030069struct pvr2_context *pvr2_context_create(struct usb_interface *intf,
70 const struct usb_device_id *devid,
71 void (*setup_func)(struct pvr2_context *));
72void pvr2_context_disconnect(struct pvr2_context *);
73
74void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
75void pvr2_channel_done(struct pvr2_channel *);
Mike Isely1cb03b72008-04-21 03:47:43 -030076int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int);
77unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *);
Mike Iselyd8554972006-06-26 20:58:46 -030078int pvr2_channel_claim_stream(struct pvr2_channel *,
79 struct pvr2_context_stream *);
80struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
81 struct pvr2_context_stream *);
82
Mike Iselye5be15c2008-04-07 02:22:04 -030083int pvr2_context_global_init(void);
84void pvr2_context_global_done(void);
Mike Iselyd8554972006-06-26 20:58:46 -030085
86#endif /* __PVRUSB2_CONTEXT_H */
87/*
88 Stuff for Emacs to see, in order to encourage consistent editing style:
89 *** Local Variables: ***
90 *** mode: c ***
91 *** fill-column: 75 ***
92 *** tab-width: 8 ***
93 *** c-basic-offset: 8 ***
94 *** End: ***
95 */