dvbdev.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * dvbdev.h
  3. *
  4. * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
  5. * for convergence integrated media GmbH
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Lesser Public License
  9. * as published by the Free Software Foundation; either version 2.1
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. *
  21. */
  22. #ifndef _DVBDEV_H_
  23. #define _DVBDEV_H_
  24. #include <linux/types.h>
  25. #include <linux/poll.h>
  26. #include <linux/fs.h>
  27. #include <linux/list.h>
  28. #include <linux/smp_lock.h>
  29. #define DVB_MAJOR 212
  30. #define DVB_DEVICE_VIDEO 0
  31. #define DVB_DEVICE_AUDIO 1
  32. #define DVB_DEVICE_SEC 2
  33. #define DVB_DEVICE_FRONTEND 3
  34. #define DVB_DEVICE_DEMUX 4
  35. #define DVB_DEVICE_DVR 5
  36. #define DVB_DEVICE_CA 6
  37. #define DVB_DEVICE_NET 7
  38. #define DVB_DEVICE_OSD 8
  39. struct dvb_adapter {
  40. int num;
  41. struct list_head list_head;
  42. struct list_head device_list;
  43. const char *name;
  44. u8 proposed_mac [6];
  45. void* priv;
  46. struct device *device;
  47. struct module *module;
  48. };
  49. struct dvb_device {
  50. struct list_head list_head;
  51. struct file_operations *fops;
  52. struct dvb_adapter *adapter;
  53. int type;
  54. u32 id;
  55. /* in theory, 'users' can vanish now,
  56. but I don't want to change too much now... */
  57. int readers;
  58. int writers;
  59. int users;
  60. wait_queue_head_t wait_queue;
  61. /* don't really need those !? -- FIXME: use video_usercopy */
  62. int (*kernel_ioctl)(struct inode *inode, struct file *file,
  63. unsigned int cmd, void *arg);
  64. void *priv;
  65. };
  66. extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device);
  67. extern int dvb_unregister_adapter (struct dvb_adapter *adap);
  68. extern int dvb_register_device (struct dvb_adapter *adap,
  69. struct dvb_device **pdvbdev,
  70. const struct dvb_device *template,
  71. void *priv,
  72. int type);
  73. extern void dvb_unregister_device (struct dvb_device *dvbdev);
  74. extern int dvb_generic_open (struct inode *inode, struct file *file);
  75. extern int dvb_generic_release (struct inode *inode, struct file *file);
  76. extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
  77. unsigned int cmd, unsigned long arg);
  78. /* we don't mess with video_usercopy() any more,
  79. we simply define out own dvb_usercopy(), which will hopefully become
  80. generic_usercopy() someday... */
  81. extern int dvb_usercopy(struct inode *inode, struct file *file,
  82. unsigned int cmd, unsigned long arg,
  83. int (*func)(struct inode *inode, struct file *file,
  84. unsigned int cmd, void *arg));
  85. /** generic DVB attach function. */
  86. #ifdef CONFIG_DVB_CORE_ATTACH
  87. #define dvb_attach(FUNCTION, ARGS...) ({ \
  88. void *__r = NULL; \
  89. typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
  90. if (__a) { \
  91. __r = (void *) __a(ARGS); \
  92. if (__r == NULL) \
  93. symbol_put(FUNCTION); \
  94. } else { \
  95. printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
  96. } \
  97. __r; \
  98. })
  99. #else
  100. #define dvb_attach(FUNCTION, ARGS...) ({ \
  101. FUNCTION(ARGS); \
  102. })
  103. #endif
  104. #endif /* #ifndef _DVBDEV_H_ */