18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2005 Mike Isely <isely@pobox.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef __PVRUSB2_CONTEXT_H 78c2ecf20Sopenharmony_ci#define __PVRUSB2_CONTEXT_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/mutex.h> 108c2ecf20Sopenharmony_ci#include <linux/usb.h> 118c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct pvr2_hdw; /* hardware interface - defined elsewhere */ 148c2ecf20Sopenharmony_cistruct pvr2_stream; /* stream interface - defined elsewhere */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistruct pvr2_context; /* All central state */ 178c2ecf20Sopenharmony_cistruct pvr2_channel; /* One I/O pathway to a user */ 188c2ecf20Sopenharmony_cistruct pvr2_context_stream; /* Wrapper for a stream */ 198c2ecf20Sopenharmony_cistruct pvr2_ioread; /* Low level stream structure */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistruct pvr2_context_stream { 228c2ecf20Sopenharmony_ci struct pvr2_channel *user; 238c2ecf20Sopenharmony_ci struct pvr2_stream *stream; 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistruct pvr2_context { 278c2ecf20Sopenharmony_ci struct pvr2_channel *mc_first; 288c2ecf20Sopenharmony_ci struct pvr2_channel *mc_last; 298c2ecf20Sopenharmony_ci struct pvr2_context *exist_next; 308c2ecf20Sopenharmony_ci struct pvr2_context *exist_prev; 318c2ecf20Sopenharmony_ci struct pvr2_context *notify_next; 328c2ecf20Sopenharmony_ci struct pvr2_context *notify_prev; 338c2ecf20Sopenharmony_ci struct pvr2_hdw *hdw; 348c2ecf20Sopenharmony_ci struct pvr2_context_stream video_stream; 358c2ecf20Sopenharmony_ci struct mutex mutex; 368c2ecf20Sopenharmony_ci int notify_flag; 378c2ecf20Sopenharmony_ci int initialized_flag; 388c2ecf20Sopenharmony_ci int disconnect_flag; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci /* Called after pvr2_context initialization is complete */ 418c2ecf20Sopenharmony_ci void (*setup_func)(struct pvr2_context *); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistruct pvr2_channel { 468c2ecf20Sopenharmony_ci struct pvr2_context *mc_head; 478c2ecf20Sopenharmony_ci struct pvr2_channel *mc_next; 488c2ecf20Sopenharmony_ci struct pvr2_channel *mc_prev; 498c2ecf20Sopenharmony_ci struct pvr2_context_stream *stream; 508c2ecf20Sopenharmony_ci struct pvr2_hdw *hdw; 518c2ecf20Sopenharmony_ci unsigned int input_mask; 528c2ecf20Sopenharmony_ci void (*check_func)(struct pvr2_channel *); 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistruct pvr2_context *pvr2_context_create(struct usb_interface *intf, 568c2ecf20Sopenharmony_ci const struct usb_device_id *devid, 578c2ecf20Sopenharmony_ci void (*setup_func)(struct pvr2_context *)); 588c2ecf20Sopenharmony_civoid pvr2_context_disconnect(struct pvr2_context *); 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_civoid pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *); 618c2ecf20Sopenharmony_civoid pvr2_channel_done(struct pvr2_channel *); 628c2ecf20Sopenharmony_ciint pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int); 638c2ecf20Sopenharmony_ciunsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *); 648c2ecf20Sopenharmony_ciint pvr2_channel_claim_stream(struct pvr2_channel *, 658c2ecf20Sopenharmony_ci struct pvr2_context_stream *); 668c2ecf20Sopenharmony_cistruct pvr2_ioread *pvr2_channel_create_mpeg_stream( 678c2ecf20Sopenharmony_ci struct pvr2_context_stream *); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ciint pvr2_context_global_init(void); 708c2ecf20Sopenharmony_civoid pvr2_context_global_done(void); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#endif /* __PVRUSB2_CONTEXT_H */ 73