dvbdev.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. #define DVB_MAJOR 212
  29. #define DVB_MAX_ADAPTERS 8
  30. #define DVB_UNSET (-1)
  31. #define DVB_DEVICE_VIDEO 0
  32. #define DVB_DEVICE_AUDIO 1
  33. #define DVB_DEVICE_SEC 2
  34. #define DVB_DEVICE_FRONTEND 3
  35. #define DVB_DEVICE_DEMUX 4
  36. #define DVB_DEVICE_DVR 5
  37. #define DVB_DEVICE_CA 6
  38. #define DVB_DEVICE_NET 7
  39. #define DVB_DEVICE_OSD 8
  40. #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
  41. static short adapter_nr[] = \
  42. {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
  43. module_param_array(adapter_nr, short, NULL, 0444); \
  44. MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
  45. struct dvb_adapter {
  46. int num;
  47. struct list_head list_head;
  48. struct list_head device_list;
  49. const char *name;
  50. u8 proposed_mac [6];
  51. void* priv;
  52. struct device *device;
  53. struct module *module;
  54. int mfe_shared; /* indicates mutually exclusive frontends */
  55. struct dvb_device *mfe_dvbdev; /* frontend device in use */
  56. struct mutex mfe_lock; /* access lock for thread creation */
  57. };
  58. struct dvb_device {
  59. struct list_head list_head;
  60. const struct file_operations *fops;
  61. struct dvb_adapter *adapter;
  62. int type;
  63. int minor;
  64. u32 id;
  65. /* in theory, 'users' can vanish now,
  66. but I don't want to change too much now... */
  67. int readers;
  68. int writers;
  69. int users;
  70. wait_queue_head_t wait_queue;
  71. /* don't really need those !? -- FIXME: use video_usercopy */
  72. int (*kernel_ioctl)(struct inode *inode, struct file *file,
  73. unsigned int cmd, void *arg);
  74. void *priv;
  75. };
  76. extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
  77. struct module *module, struct device *device,
  78. short *adapter_nums);
  79. extern int dvb_unregister_adapter (struct dvb_adapter *adap);
  80. extern int dvb_register_device (struct dvb_adapter *adap,
  81. struct dvb_device **pdvbdev,
  82. const struct dvb_device *template,
  83. void *priv,
  84. int type);
  85. extern void dvb_unregister_device (struct dvb_device *dvbdev);
  86. extern int dvb_generic_open (struct inode *inode, struct file *file);
  87. extern int dvb_generic_release (struct inode *inode, struct file *file);
  88. extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
  89. unsigned int cmd, unsigned long arg);
  90. /* we don't mess with video_usercopy() any more,
  91. we simply define out own dvb_usercopy(), which will hopefully become
  92. generic_usercopy() someday... */
  93. extern int dvb_usercopy(struct inode *inode, struct file *file,
  94. unsigned int cmd, unsigned long arg,
  95. int (*func)(struct inode *inode, struct file *file,
  96. unsigned int cmd, void *arg));
  97. /** generic DVB attach function. */
  98. #ifdef CONFIG_MEDIA_ATTACH
  99. #define dvb_attach(FUNCTION, ARGS...) ({ \
  100. void *__r = NULL; \
  101. typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
  102. if (__a) { \
  103. __r = (void *) __a(ARGS); \
  104. if (__r == NULL) \
  105. symbol_put(FUNCTION); \
  106. } else { \
  107. printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
  108. } \
  109. __r; \
  110. })
  111. #else
  112. #define dvb_attach(FUNCTION, ARGS...) ({ \
  113. FUNCTION(ARGS); \
  114. })
  115. #endif
  116. #endif /* #ifndef _DVBDEV_H_ */