pvrusb2-context.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #include <linux/mutex.h>
  22. #include <linux/usb.h>
  23. #include <linux/workqueue.h>
  24. struct pvr2_hdw; /* hardware interface - defined elsewhere */
  25. struct pvr2_stream; /* stream interface - defined elsewhere */
  26. struct pvr2_context; /* All central state */
  27. struct pvr2_channel; /* One I/O pathway to a user */
  28. struct pvr2_context_stream; /* Wrapper for a stream */
  29. struct pvr2_ioread; /* Low level stream structure */
  30. struct pvr2_context_stream {
  31. struct pvr2_channel *user;
  32. struct pvr2_stream *stream;
  33. };
  34. struct pvr2_context {
  35. struct pvr2_channel *mc_first;
  36. struct pvr2_channel *mc_last;
  37. struct pvr2_context *exist_next;
  38. struct pvr2_context *exist_prev;
  39. struct pvr2_context *notify_next;
  40. struct pvr2_context *notify_prev;
  41. struct pvr2_hdw *hdw;
  42. struct pvr2_context_stream video_stream;
  43. struct mutex mutex;
  44. int notify_flag;
  45. int initialized_flag;
  46. int disconnect_flag;
  47. /* Called after pvr2_context initialization is complete */
  48. void (*setup_func)(struct pvr2_context *);
  49. };
  50. struct pvr2_channel {
  51. struct pvr2_context *mc_head;
  52. struct pvr2_channel *mc_next;
  53. struct pvr2_channel *mc_prev;
  54. struct pvr2_context_stream *stream;
  55. struct pvr2_hdw *hdw;
  56. unsigned int input_mask;
  57. void (*check_func)(struct pvr2_channel *);
  58. };
  59. struct pvr2_context *pvr2_context_create(struct usb_interface *intf,
  60. const struct usb_device_id *devid,
  61. void (*setup_func)(struct pvr2_context *));
  62. void pvr2_context_disconnect(struct pvr2_context *);
  63. void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
  64. void pvr2_channel_done(struct pvr2_channel *);
  65. int pvr2_channel_limit_inputs(struct pvr2_channel *,unsigned int);
  66. unsigned int pvr2_channel_get_limited_inputs(struct pvr2_channel *);
  67. int pvr2_channel_claim_stream(struct pvr2_channel *,
  68. struct pvr2_context_stream *);
  69. struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
  70. struct pvr2_context_stream *);
  71. int pvr2_context_global_init(void);
  72. void pvr2_context_global_done(void);
  73. #endif /* __PVRUSB2_CONTEXT_H */