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