blob: 2a34028ccbcdcacafc2524e45bb5eb1f2f05b3a0 [file] [log] [blame]
Henrik Kureliddf4846c2008-08-01 10:00:45 +02001/*
Stefan Richter612262a2008-08-26 00:17:30 +02002 * FireDTV driver (formerly known as FireSAT)
Henrik Kureliddf4846c2008-08-01 10:00:45 +02003 *
Stefan Richter612262a2008-08-26 00:17:30 +02004 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
Henrik Kureliddf4846c2008-08-01 10:00:45 +02006 *
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
Stefan Richter612262a2008-08-26 00:17:30 +020013#ifndef _FIREDTV_H
14#define _FIREDTV_H
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080015
Stefan Richter612262a2008-08-26 00:17:30 +020016#include <linux/dvb/dmx.h>
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>
Stefan Richter612262a2008-08-26 00:17:30 +020024
25#include <demux.h>
26#include <dmxdev.h>
27#include <dvb_demux.h>
Stefan Richter8ae83cd2008-11-02 13:45:00 +010028#include <dvb_frontend.h>
Stefan Richter612262a2008-08-26 00:17:30 +020029#include <dvb_net.h>
30#include <dvbdev.h>
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080031
Henrik Kureliddf4846c2008-08-01 10:00:45 +020032#include <linux/version.h>
33#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
Henrik Kureliddf4846c2008-08-01 10:00:45 +020034#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
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800121
122enum model_type {
Rambaldia70f81c2009-01-17 14:47:34 +0100123 FIREDTV_UNKNOWN = 0,
124 FIREDTV_DVB_S = 1,
125 FIREDTV_DVB_C = 2,
126 FIREDTV_DVB_T = 3,
127 FIREDTV_DVB_S2 = 4,
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800128};
129
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100130struct input_dev;
Stefan Richter612262a2008-08-26 00:17:30 +0200131struct hpsb_iso;
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100132struct unit_directory;
Stefan Richter612262a2008-08-26 00:17:30 +0200133
Rambaldia70f81c2009-01-17 14:47:34 +0100134struct firedtv {
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100135 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;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800141
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100142 struct dvb_device *cadev;
143 int ca_last_command;
144 int ca_time_interval;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800145
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100146 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;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800151
Rambaldia70f81c2009-01-17 14:47:34 +0100152 struct firedtv_channel {
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100153 bool active;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800154 int pid;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800155 } channel[16];
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100156 struct mutex demux_mutex;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800157
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100158 struct unit_directory *ud;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800159
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200160 enum model_type type;
161 char subunit;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800162 fe_sec_voltage_t voltage;
163 fe_sec_tone_mode_t tone;
164
165 int isochannel;
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200166 struct hpsb_iso *iso_handle;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800167
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200168 struct list_head list;
Stefan Richter8ae83cd2008-11-02 13:45:00 +0100169
170 /* needed by avc_api */
171 int resp_length;
172 u8 respfrm[512];
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200173};
174
175struct 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};
189
190struct 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 };
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800207};
208
Rambaldia70f81c2009-01-17 14:47:34 +0100209extern const char *fdtv_model_names[];
210extern struct list_head fdtv_list;
211extern spinlock_t fdtv_list_lock;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800212
Stefan Richter612262a2008-08-26 00:17:30 +0200213struct device;
214
Rambaldia70f81c2009-01-17 14:47:34 +0100215/* firedtv-dvb.c */
216int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
217int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
218int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev);
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800219
Rambaldia70f81c2009-01-17 14:47:34 +0100220/* firedtv-fe.c */
221void fdtv_frontend_init(struct firedtv *fdtv);
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800222
Rambaldia70f81c2009-01-17 14:47:34 +0100223/* firedtv-iso.c */
224int setup_iso_channel(struct firedtv *fdtv);
225void tear_down_iso_channel(struct firedtv *fdtv);
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800226
Stefan Richter612262a2008-08-26 00:17:30 +0200227#endif /* _FIREDTV_H */