pvrusb2-context.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2005 Mike Isely <isely@pobox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #ifndef __PVRUSB2_BASE_H
  21. #define __PVRUSB2_BASE_H
  22. #include <linux/mutex.h>
  23. #include <linux/usb.h>
  24. #include <linux/workqueue.h>
  25. struct pvr2_hdw; /* hardware interface - defined elsewhere */
  26. struct pvr2_stream; /* stream interface - defined elsewhere */
  27. struct pvr2_context; /* All central state */
  28. struct pvr2_channel; /* One I/O pathway to a user */
  29. struct pvr2_context_stream; /* Wrapper for a stream */
  30. struct pvr2_crit_reg; /* Critical region pointer */
  31. struct pvr2_ioread; /* Low level stream structure */
  32. struct pvr2_context_stream {
  33. struct pvr2_channel *user;
  34. struct pvr2_stream *stream;
  35. };
  36. struct pvr2_context {
  37. struct pvr2_channel *mc_first;
  38. struct pvr2_channel *mc_last;
  39. struct pvr2_hdw *hdw;
  40. struct pvr2_context_stream video_stream;
  41. struct mutex mutex;
  42. int disconnect_flag;
  43. /* Called after pvr2_context initialization is complete */
  44. void (*setup_func)(struct pvr2_context *);
  45. /* Work queue overhead for out-of-line processing */
  46. struct workqueue_struct *workqueue;
  47. struct work_struct workinit;
  48. struct work_struct workpoll;
  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. void (*check_func)(struct pvr2_channel *);
  57. };
  58. void pvr2_context_enter(struct pvr2_context *);
  59. void pvr2_context_exit(struct pvr2_context *);
  60. struct pvr2_context *pvr2_context_create(struct usb_interface *intf,
  61. const struct usb_device_id *devid,
  62. void (*setup_func)(struct pvr2_context *));
  63. void pvr2_context_disconnect(struct pvr2_context *);
  64. void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
  65. void pvr2_channel_done(struct pvr2_channel *);
  66. int pvr2_channel_claim_stream(struct pvr2_channel *,
  67. struct pvr2_context_stream *);
  68. struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
  69. struct pvr2_context_stream *);
  70. #endif /* __PVRUSB2_CONTEXT_H */
  71. /*
  72. Stuff for Emacs to see, in order to encourage consistent editing style:
  73. *** Local Variables: ***
  74. *** mode: c ***
  75. *** fill-column: 75 ***
  76. *** tab-width: 8 ***
  77. *** c-basic-offset: 8 ***
  78. *** End: ***
  79. */