1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Copyright (C) 2005 Mike Isely <isely@pobox.com> 5*4882a593Smuzhiyun */ 6*4882a593Smuzhiyun #ifndef __PVRUSB2_CONTEXT_H 7*4882a593Smuzhiyun #define __PVRUSB2_CONTEXT_H 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun #include <linux/mutex.h> 10*4882a593Smuzhiyun #include <linux/usb.h> 11*4882a593Smuzhiyun #include <linux/workqueue.h> 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun struct pvr2_hdw; /* hardware interface - defined elsewhere */ 14*4882a593Smuzhiyun struct pvr2_stream; /* stream interface - defined elsewhere */ 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun struct pvr2_context; /* All central state */ 17*4882a593Smuzhiyun struct pvr2_channel; /* One I/O pathway to a user */ 18*4882a593Smuzhiyun struct pvr2_context_stream; /* Wrapper for a stream */ 19*4882a593Smuzhiyun struct pvr2_ioread; /* Low level stream structure */ 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun struct pvr2_context_stream { 22*4882a593Smuzhiyun struct pvr2_channel *user; 23*4882a593Smuzhiyun struct pvr2_stream *stream; 24*4882a593Smuzhiyun }; 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun struct pvr2_context { 27*4882a593Smuzhiyun struct pvr2_channel *mc_first; 28*4882a593Smuzhiyun struct pvr2_channel *mc_last; 29*4882a593Smuzhiyun struct pvr2_context *exist_next; 30*4882a593Smuzhiyun struct pvr2_context *exist_prev; 31*4882a593Smuzhiyun struct pvr2_context *notify_next; 32*4882a593Smuzhiyun struct pvr2_context *notify_prev; 33*4882a593Smuzhiyun struct pvr2_hdw *hdw; 34*4882a593Smuzhiyun struct pvr2_context_stream video_stream; 35*4882a593Smuzhiyun struct mutex mutex; 36*4882a593Smuzhiyun int notify_flag; 37*4882a593Smuzhiyun int initialized_flag; 38*4882a593Smuzhiyun int disconnect_flag; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun /* Called after pvr2_context initialization is complete */ 41*4882a593Smuzhiyun void (*setup_func)(struct pvr2_context *); 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun }; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun struct pvr2_channel { 46*4882a593Smuzhiyun struct pvr2_context *mc_head; 47*4882a593Smuzhiyun struct pvr2_channel *mc_next; 48*4882a593Smuzhiyun struct pvr2_channel *mc_prev; 49*4882a593Smuzhiyun struct pvr2_context_stream *stream; 50*4882a593Smuzhiyun struct pvr2_hdw *hdw; 51*4882a593Smuzhiyun unsigned int input_mask; 52*4882a593Smuzhiyun void (*check_func)(struct pvr2_channel *); 53*4882a593Smuzhiyun }; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun struct pvr2_context *pvr2_context_create(struct usb_interface *intf, 56*4882a593Smuzhiyun const struct usb_device_id *devid, 57*4882a593Smuzhiyun void (*setup_func)(struct pvr2_context *)); 58*4882a593Smuzhiyun void pvr2_context_disconnect(struct pvr2_context *); 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *); 61*4882a593Smuzhiyun void pvr2_channel_done(struct pvr2_channel *); 62*4882a593Smuzhiyun int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int); 63*4882a593Smuzhiyun unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *); 64*4882a593Smuzhiyun int pvr2_channel_claim_stream(struct pvr2_channel *, 65*4882a593Smuzhiyun struct pvr2_context_stream *); 66*4882a593Smuzhiyun struct pvr2_ioread *pvr2_channel_create_mpeg_stream( 67*4882a593Smuzhiyun struct pvr2_context_stream *); 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun int pvr2_context_global_init(void); 70*4882a593Smuzhiyun void pvr2_context_global_done(void); 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun #endif /* __PVRUSB2_CONTEXT_H */ 73