pvrusb2-context.h 2.1 KB

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