blob: a04187a932251dd86b11020916f55c31c3da51c5 [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 */
33struct pvr2_crit_reg; /* Critical region pointer */
34struct pvr2_ioread; /* Low level stream structure */
35
36struct pvr2_context_stream {
37 struct pvr2_channel *user;
38 struct pvr2_stream *stream;
39};
40
41struct pvr2_context {
42 struct pvr2_channel *mc_first;
43 struct pvr2_channel *mc_last;
44 struct pvr2_hdw *hdw;
45 struct pvr2_context_stream video_stream;
46 struct mutex mutex;
47 int disconnect_flag;
Mike Isely681c7392007-11-26 01:48:52 -030048 int init_flag;
Mike Iselyd8554972006-06-26 20:58:46 -030049
50 /* Called after pvr2_context initialization is complete */
51 void (*setup_func)(struct pvr2_context *);
52
Mike Iselyd8554972006-06-26 20:58:46 -030053};
54
55struct pvr2_channel {
56 struct pvr2_context *mc_head;
57 struct pvr2_channel *mc_next;
58 struct pvr2_channel *mc_prev;
59 struct pvr2_context_stream *stream;
60 struct pvr2_hdw *hdw;
61 void (*check_func)(struct pvr2_channel *);
62};
63
64void pvr2_context_enter(struct pvr2_context *);
65void pvr2_context_exit(struct pvr2_context *);
66
67struct pvr2_context *pvr2_context_create(struct usb_interface *intf,
68 const struct usb_device_id *devid,
69 void (*setup_func)(struct pvr2_context *));
70void pvr2_context_disconnect(struct pvr2_context *);
71
72void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
73void pvr2_channel_done(struct pvr2_channel *);
74int pvr2_channel_claim_stream(struct pvr2_channel *,
75 struct pvr2_context_stream *);
76struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
77 struct pvr2_context_stream *);
78
79
80#endif /* __PVRUSB2_CONTEXT_H */
81/*
82 Stuff for Emacs to see, in order to encourage consistent editing style:
83 *** Local Variables: ***
84 *** mode: c ***
85 *** fill-column: 75 ***
86 *** tab-width: 8 ***
87 *** c-basic-offset: 8 ***
88 *** End: ***
89 */