blob: d657e53bbfa3770448ff8eb0426c6f8bd5be9fc6 [file] [log] [blame]
Mike Iselyd8554972006-06-26 20:58:46 -03001/*
Mike Iselyd8554972006-06-26 20:58:46 -03002 *
3 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
Mike Iselyd417f712008-07-25 19:50:52 -030019#ifndef __PVRUSB2_CONTEXT_H
20#define __PVRUSB2_CONTEXT_H
Mike Iselyd8554972006-06-26 20:58:46 -030021
22#include <linux/mutex.h>
23#include <linux/usb.h>
24#include <linux/workqueue.h>
25
26struct pvr2_hdw; /* hardware interface - defined elsewhere */
27struct pvr2_stream; /* stream interface - defined elsewhere */
28
29struct pvr2_context; /* All central state */
30struct pvr2_channel; /* One I/O pathway to a user */
31struct pvr2_context_stream; /* Wrapper for a stream */
Mike Iselyd8554972006-06-26 20:58:46 -030032struct pvr2_ioread; /* Low level stream structure */
33
34struct pvr2_context_stream {
35 struct pvr2_channel *user;
36 struct pvr2_stream *stream;
37};
38
39struct pvr2_context {
40 struct pvr2_channel *mc_first;
41 struct pvr2_channel *mc_last;
Mike Iselye5be15c2008-04-07 02:22:04 -030042 struct pvr2_context *exist_next;
43 struct pvr2_context *exist_prev;
44 struct pvr2_context *notify_next;
45 struct pvr2_context *notify_prev;
Mike Iselyd8554972006-06-26 20:58:46 -030046 struct pvr2_hdw *hdw;
47 struct pvr2_context_stream video_stream;
48 struct mutex mutex;
Mike Isely794b1602008-04-22 14:45:45 -030049 int notify_flag;
Mike Iselye5be15c2008-04-07 02:22:04 -030050 int initialized_flag;
Mike Iselyd8554972006-06-26 20:58:46 -030051 int disconnect_flag;
Mike Isely794b1602008-04-22 14:45:45 -030052
Mike Iselyd8554972006-06-26 20:58:46 -030053 /* Called after pvr2_context initialization is complete */
54 void (*setup_func)(struct pvr2_context *);
55
Mike Iselyd8554972006-06-26 20:58:46 -030056};
57
58struct pvr2_channel {
59 struct pvr2_context *mc_head;
60 struct pvr2_channel *mc_next;
61 struct pvr2_channel *mc_prev;
62 struct pvr2_context_stream *stream;
63 struct pvr2_hdw *hdw;
Mike Isely1cb03b72008-04-21 03:47:43 -030064 unsigned int input_mask;
Mike Iselyd8554972006-06-26 20:58:46 -030065 void (*check_func)(struct pvr2_channel *);
66};
67
Mike Iselyd8554972006-06-26 20:58:46 -030068struct pvr2_context *pvr2_context_create(struct usb_interface *intf,
69 const struct usb_device_id *devid,
70 void (*setup_func)(struct pvr2_context *));
71void pvr2_context_disconnect(struct pvr2_context *);
72
73void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
74void pvr2_channel_done(struct pvr2_channel *);
Mike Isely1cb03b72008-04-21 03:47:43 -030075int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int);
76unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *);
Mike Iselyd8554972006-06-26 20:58:46 -030077int pvr2_channel_claim_stream(struct pvr2_channel *,
78 struct pvr2_context_stream *);
79struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
80 struct pvr2_context_stream *);
81
Mike Iselye5be15c2008-04-07 02:22:04 -030082int pvr2_context_global_init(void);
83void pvr2_context_global_done(void);
Mike Iselyd8554972006-06-26 20:58:46 -030084
85#endif /* __PVRUSB2_CONTEXT_H */
86/*
87 Stuff for Emacs to see, in order to encourage consistent editing style:
88 *** Local Variables: ***
89 *** mode: c ***
90 *** fill-column: 75 ***
91 *** tab-width: 8 ***
92 *** c-basic-offset: 8 ***
93 *** End: ***
94 */