| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 1 | /* | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 2 |  * | 
 | 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 Isely | d417f71 | 2008-07-25 19:50:52 -0300 | [diff] [blame] | 19 | #ifndef __PVRUSB2_CONTEXT_H | 
 | 20 | #define __PVRUSB2_CONTEXT_H | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 21 |  | 
 | 22 | #include <linux/mutex.h> | 
 | 23 | #include <linux/usb.h> | 
 | 24 | #include <linux/workqueue.h> | 
 | 25 |  | 
 | 26 | struct pvr2_hdw;     /* hardware interface - defined elsewhere */ | 
 | 27 | struct pvr2_stream;  /* stream interface - defined elsewhere */ | 
 | 28 |  | 
 | 29 | struct pvr2_context;        /* All central state */ | 
 | 30 | struct pvr2_channel;        /* One I/O pathway to a user */ | 
 | 31 | struct pvr2_context_stream; /* Wrapper for a stream */ | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 32 | struct pvr2_ioread;         /* Low level stream structure */ | 
 | 33 |  | 
 | 34 | struct pvr2_context_stream { | 
 | 35 | 	struct pvr2_channel *user; | 
 | 36 | 	struct pvr2_stream *stream; | 
 | 37 | }; | 
 | 38 |  | 
 | 39 | struct pvr2_context { | 
 | 40 | 	struct pvr2_channel *mc_first; | 
 | 41 | 	struct pvr2_channel *mc_last; | 
| Mike Isely | e5be15c | 2008-04-07 02:22:04 -0300 | [diff] [blame] | 42 | 	struct pvr2_context *exist_next; | 
 | 43 | 	struct pvr2_context *exist_prev; | 
 | 44 | 	struct pvr2_context *notify_next; | 
 | 45 | 	struct pvr2_context *notify_prev; | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 46 | 	struct pvr2_hdw *hdw; | 
 | 47 | 	struct pvr2_context_stream video_stream; | 
 | 48 | 	struct mutex mutex; | 
| Mike Isely | 794b160 | 2008-04-22 14:45:45 -0300 | [diff] [blame] | 49 | 	int notify_flag; | 
| Mike Isely | e5be15c | 2008-04-07 02:22:04 -0300 | [diff] [blame] | 50 | 	int initialized_flag; | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 51 | 	int disconnect_flag; | 
| Mike Isely | 794b160 | 2008-04-22 14:45:45 -0300 | [diff] [blame] | 52 |  | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 53 | 	/* Called after pvr2_context initialization is complete */ | 
 | 54 | 	void (*setup_func)(struct pvr2_context *); | 
 | 55 |  | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 56 | }; | 
 | 57 |  | 
 | 58 | struct 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 Isely | 1cb03b7 | 2008-04-21 03:47:43 -0300 | [diff] [blame] | 64 | 	unsigned int input_mask; | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 65 | 	void (*check_func)(struct pvr2_channel *); | 
 | 66 | }; | 
 | 67 |  | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 68 | struct pvr2_context *pvr2_context_create(struct usb_interface *intf, | 
 | 69 | 					 const struct usb_device_id *devid, | 
 | 70 | 					 void (*setup_func)(struct pvr2_context *)); | 
 | 71 | void pvr2_context_disconnect(struct pvr2_context *); | 
 | 72 |  | 
 | 73 | void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *); | 
 | 74 | void pvr2_channel_done(struct pvr2_channel *); | 
| Mike Isely | 1cb03b7 | 2008-04-21 03:47:43 -0300 | [diff] [blame] | 75 | int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int); | 
 | 76 | unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *); | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 77 | int pvr2_channel_claim_stream(struct pvr2_channel *, | 
 | 78 | 			      struct pvr2_context_stream *); | 
 | 79 | struct pvr2_ioread *pvr2_channel_create_mpeg_stream( | 
 | 80 | 	struct pvr2_context_stream *); | 
 | 81 |  | 
| Mike Isely | e5be15c | 2008-04-07 02:22:04 -0300 | [diff] [blame] | 82 | int pvr2_context_global_init(void); | 
 | 83 | void pvr2_context_global_done(void); | 
| Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 84 |  | 
 | 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 |   */ |