firesat.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * FireDTV driver (formerly known as FireSAT)
  3. *
  4. * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
  5. * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. */
  12. #ifndef _FIREDTV_H
  13. #define _FIREDTV_H
  14. #include <linux/dvb/dmx.h>
  15. #include <linux/dvb/frontend.h>
  16. #include <linux/list.h>
  17. #include <linux/mutex.h>
  18. #include <linux/spinlock_types.h>
  19. #include <linux/types.h>
  20. #include <linux/wait.h>
  21. #include <linux/workqueue.h>
  22. #include <demux.h>
  23. #include <dmxdev.h>
  24. #include <dvb_demux.h>
  25. #include <dvb_frontend.h>
  26. #include <dvb_net.h>
  27. #include <dvbdev.h>
  28. #include <linux/version.h>
  29. #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
  30. #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v)
  31. #else
  32. #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w)
  33. #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(x)
  34. #endif
  35. /*****************************************************************
  36. * CA message command constants from en50221_app_tags.h of libdvb
  37. *****************************************************************/
  38. /* Resource Manager */
  39. #define TAG_PROFILE_ENQUIRY 0x9f8010
  40. #define TAG_PROFILE 0x9f8011
  41. #define TAG_PROFILE_CHANGE 0x9f8012
  42. /* Application Info */
  43. #define TAG_APP_INFO_ENQUIRY 0x9f8020
  44. #define TAG_APP_INFO 0x9f8021
  45. #define TAG_ENTER_MENU 0x9f8022
  46. /* CA Support */
  47. #define TAG_CA_INFO_ENQUIRY 0x9f8030
  48. #define TAG_CA_INFO 0x9f8031
  49. #define TAG_CA_PMT 0x9f8032
  50. #define TAG_CA_PMT_REPLY 0x9f8033
  51. /* Host Control */
  52. #define TAG_TUNE 0x9f8400
  53. #define TAG_REPLACE 0x9f8401
  54. #define TAG_CLEAR_REPLACE 0x9f8402
  55. #define TAG_ASK_RELEASE 0x9f8403
  56. /* Date and Time */
  57. #define TAG_DATE_TIME_ENQUIRY 0x9f8440
  58. #define TAG_DATE_TIME 0x9f8441
  59. /* Man Machine Interface (MMI) */
  60. #define TAG_CLOSE_MMI 0x9f8800
  61. #define TAG_DISPLAY_CONTROL 0x9f8801
  62. #define TAG_DISPLAY_REPLY 0x9f8802
  63. #define TAG_TEXT_LAST 0x9f8803
  64. #define TAG_TEXT_MORE 0x9f8804
  65. #define TAG_KEYPAD_CONTROL 0x9f8805
  66. #define TAG_KEYPRESS 0x9f8806
  67. #define TAG_ENQUIRY 0x9f8807
  68. #define TAG_ANSWER 0x9f8808
  69. #define TAG_MENU_LAST 0x9f8809
  70. #define TAG_MENU_MORE 0x9f880a
  71. #define TAG_MENU_ANSWER 0x9f880b
  72. #define TAG_LIST_LAST 0x9f880c
  73. #define TAG_LIST_MORE 0x9f880d
  74. #define TAG_SUBTITLE_SEGMENT_LAST 0x9f880e
  75. #define TAG_SUBTITLE_SEGMENT_MORE 0x9f880f
  76. #define TAG_DISPLAY_MESSAGE 0x9f8810
  77. #define TAG_SCENE_END_MARK 0x9f8811
  78. #define TAG_SCENE_DONE 0x9f8812
  79. #define TAG_SCENE_CONTROL 0x9f8813
  80. #define TAG_SUBTITLE_DOWNLOAD_LAST 0x9f8814
  81. #define TAG_SUBTITLE_DOWNLOAD_MORE 0x9f8815
  82. #define TAG_FLUSH_DOWNLOAD 0x9f8816
  83. #define TAG_DOWNLOAD_REPLY 0x9f8817
  84. /* Low Speed Communications */
  85. #define TAG_COMMS_COMMAND 0x9f8c00
  86. #define TAG_CONNECTION_DESCRIPTOR 0x9f8c01
  87. #define TAG_COMMS_REPLY 0x9f8c02
  88. #define TAG_COMMS_SEND_LAST 0x9f8c03
  89. #define TAG_COMMS_SEND_MORE 0x9f8c04
  90. #define TAG_COMMS_RECV_LAST 0x9f8c05
  91. #define TAG_COMMS_RECV_MORE 0x9f8c06
  92. /* Authentication */
  93. #define TAG_AUTH_REQ 0x9f8200
  94. #define TAG_AUTH_RESP 0x9f8201
  95. /* Teletext */
  96. #define TAG_TELETEXT_EBU 0x9f9000
  97. /* Smartcard */
  98. #define TAG_SMARTCARD_COMMAND 0x9f8e00
  99. #define TAG_SMARTCARD_REPLY 0x9f8e01
  100. #define TAG_SMARTCARD_SEND 0x9f8e02
  101. #define TAG_SMARTCARD_RCV 0x9f8e03
  102. /* EPG */
  103. #define TAG_EPG_ENQUIRY 0x9f8f00
  104. #define TAG_EPG_REPLY 0x9f8f01
  105. enum model_type {
  106. FireSAT_UNKNOWN = 0,
  107. FireSAT_DVB_S = 1,
  108. FireSAT_DVB_C = 2,
  109. FireSAT_DVB_T = 3,
  110. FireSAT_DVB_S2 = 4,
  111. };
  112. struct input_dev;
  113. struct hpsb_iso;
  114. struct unit_directory;
  115. struct firesat {
  116. struct dvb_adapter adapter;
  117. struct dmxdev dmxdev;
  118. struct dvb_demux demux;
  119. struct dmx_frontend frontend;
  120. struct dvb_net dvbnet;
  121. struct dvb_frontend fe;
  122. struct dvb_device *cadev;
  123. int ca_last_command;
  124. int ca_time_interval;
  125. struct mutex avc_mutex;
  126. wait_queue_head_t avc_wait;
  127. bool avc_reply_received;
  128. struct work_struct remote_ctrl_work;
  129. struct input_dev *remote_ctrl_dev;
  130. struct firesat_channel {
  131. bool active;
  132. int pid;
  133. } channel[16];
  134. struct mutex demux_mutex;
  135. struct unit_directory *ud;
  136. enum model_type type;
  137. char subunit;
  138. fe_sec_voltage_t voltage;
  139. fe_sec_tone_mode_t tone;
  140. int isochannel;
  141. struct hpsb_iso *iso_handle;
  142. struct list_head list;
  143. /* needed by avc_api */
  144. int resp_length;
  145. u8 respfrm[512];
  146. };
  147. struct firewireheader {
  148. union {
  149. struct {
  150. __u8 tcode:4;
  151. __u8 sy:4;
  152. __u8 tag:2;
  153. __u8 channel:6;
  154. __u8 length_l;
  155. __u8 length_h;
  156. } hdr;
  157. __u32 val;
  158. };
  159. };
  160. struct CIPHeader {
  161. union {
  162. struct {
  163. __u8 syncbits:2;
  164. __u8 sid:6;
  165. __u8 dbs;
  166. __u8 fn:2;
  167. __u8 qpc:3;
  168. __u8 sph:1;
  169. __u8 rsv:2;
  170. __u8 dbc;
  171. __u8 syncbits2:2;
  172. __u8 fmt:6;
  173. __u32 fdf:24;
  174. } cip;
  175. __u64 val;
  176. };
  177. };
  178. extern const char *firedtv_model_names[];
  179. extern struct list_head firesat_list;
  180. extern spinlock_t firesat_list_lock;
  181. struct device;
  182. /* firesat_dvb.c */
  183. int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed);
  184. int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
  185. int firesat_dvbdev_init(struct firesat *firesat, struct device *dev);
  186. /* firesat_fe.c */
  187. void firesat_frontend_init(struct firesat *firesat);
  188. /* firesat_iso.c */
  189. int setup_iso_channel(struct firesat *firesat);
  190. void tear_down_iso_channel(struct firesat *firesat);
  191. #endif /* _FIREDTV_H */