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