1 /* 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 */ 19 #ifndef __PVRUSB2_CONTEXT_H 20 #define __PVRUSB2_CONTEXT_H 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 */ 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; 42 struct pvr2_context *exist_next; 43 struct pvr2_context *exist_prev; 44 struct pvr2_context *notify_next; 45 struct pvr2_context *notify_prev; 46 struct pvr2_hdw *hdw; 47 struct pvr2_context_stream video_stream; 48 struct mutex mutex; 49 int notify_flag; 50 int initialized_flag; 51 int disconnect_flag; 52 53 /* Called after pvr2_context initialization is complete */ 54 void (*setup_func)(struct pvr2_context *); 55 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; 64 unsigned int input_mask; 65 void (*check_func)(struct pvr2_channel *); 66 }; 67 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 *); 75 int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int); 76 unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *); 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 82 int pvr2_context_global_init(void); 83 void pvr2_context_global_done(void); 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 */ 95