pvrusb2-context.h 2.5 KB

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