aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firesat/avc_api.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-03-07 00:30:23 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-24 08:51:25 -0500
commitc81c8b68b46752721b0c1addfabb828da27e1489 (patch)
tree59d2a336150ce59780b73ba8dc59a829e217b2d0 /drivers/media/dvb/firesat/avc_api.h
parentf7e603ad8f78cd3b59e33fa72707da0cbabdf699 (diff)
DVB: add firesat driver
Original code written by Christian Dolzer <c.dolzer@digital-everywhere.com> Cleaned up by Greg. Major cleanup and reorg by Manu Abraham <manu@linuxtv.org> Additions also by Ben Backx <ben@bbackx.com> Cc: Christian Dolzer <c.dolzer@digital-everywhere.com> Cc: Andreas Monitzer <andy@monitzer.com> Cc: Manu Abraham <manu@linuxtv.org> Cc: Fabio De Lorenzo <delorenzo.fabio@gmail.com> Cc: Robert Berger <robert.berger@reliableembeddedsystems.com> Signed-off-by: Ben Backx <ben@bbackx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Added missing dependency to dvb/firesat/Kconfig, Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Tweaked dvb/Makefile. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/media/dvb/firesat/avc_api.h')
-rw-r--r--drivers/media/dvb/firesat/avc_api.h381
1 files changed, 381 insertions, 0 deletions
diff --git a/drivers/media/dvb/firesat/avc_api.h b/drivers/media/dvb/firesat/avc_api.h
new file mode 100644
index 000000000000..f9a190adcd37
--- /dev/null
+++ b/drivers/media/dvb/firesat/avc_api.h
@@ -0,0 +1,381 @@
1/***************************************************************************
2 avc_api.h - description
3 -------------------
4 begin : Wed May 1 2000
5 copyright : (C) 2000 by Manfred Weihs
6 copyright : (C) 2003 by Philipp Gutgsell
7 email : 0014guph@edu.fh-kaernten.ac.at
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19/*
20 This is based on code written by Peter Halwachs,
21 Thomas Groiss and Andreas Monitzer.
22*/
23
24
25#ifndef __AVC_API_H__
26#define __AVC_API_H__
27
28#include <linux/dvb/frontend.h>
29
30#define BYTE unsigned char
31#define WORD unsigned short
32#define DWORD unsigned long
33#define ULONG unsigned long
34#define LONG long
35
36
37/*************************************************************
38 FCP Address range
39**************************************************************/
40
41#define RESPONSE_REGISTER 0xFFFFF0000D00ULL
42#define COMMAND_REGISTER 0xFFFFF0000B00ULL
43#define PCR_BASE_ADDRESS 0xFFFFF0000900ULL
44
45
46/************************************************************
47 definition of structures
48*************************************************************/
49typedef struct {
50 int Nr_SourcePlugs;
51 int Nr_DestinationPlugs;
52} TunerInfo;
53
54
55/***********************************************
56
57 supported cts
58
59************************************************/
60
61#define AVC 0x0
62
63// FCP command frame with ctype = 0x0 is AVC command frame
64
65#ifdef __LITTLE_ENDIAN
66
67// Definition FCP Command Frame
68typedef struct _AVCCmdFrm
69{
70 // AV/C command frame
71 BYTE ctype : 4 ; // command type
72 BYTE cts : 4 ; // always 0x0 for AVC
73 BYTE suid : 3 ; // subunit ID
74 BYTE sutyp : 5 ; // subunit_typ
75 BYTE opcode : 8 ; // opcode
76 BYTE operand[509] ; // array of operands [1-507]
77 int length; //length of the command frame
78} AVCCmdFrm ;
79
80// Definition FCP Response Frame
81typedef struct _AVCRspFrm
82{
83 // AV/C response frame
84 BYTE resp : 4 ; // response type
85 BYTE cts : 4 ; // always 0x0 for AVC
86 BYTE suid : 3 ; // subunit ID
87 BYTE sutyp : 5 ; // subunit_typ
88 BYTE opcode : 8 ; // opcode
89 BYTE operand[509] ; // array of operands [1-507]
90 int length; //length of the response frame
91} AVCRspFrm ;
92
93#else
94
95typedef struct _AVCCmdFrm
96{
97 BYTE cts:4;
98 BYTE ctype:4;
99 BYTE sutyp:5;
100 BYTE suid:3;
101 BYTE opcode;
102 BYTE operand[509];
103 int length;
104} AVCCmdFrm;
105
106typedef struct _AVCRspFrm
107{
108 BYTE cts:4;
109 BYTE resp:4;
110 BYTE sutyp:5;
111 BYTE suid:3;
112 BYTE opcode;
113 BYTE operand[509];
114 int length;
115} AVCRspFrm;
116
117#endif
118
119/*************************************************************
120 AVC command types (ctype)
121**************************************************************///
122#define CONTROL 0x00
123#define STATUS 0x01
124#define INQUIRY 0x02
125#define NOTIFY 0x03
126
127/*************************************************************
128 AVC respond types
129**************************************************************///
130#define NOT_IMPLEMENTED 0x8
131#define ACCEPTED 0x9
132#define REJECTED 0xA
133#define STABLE 0xC
134#define CHANGED 0xD
135#define INTERIM 0xF
136
137/*************************************************************
138 AVC opcodes
139**************************************************************///
140#define CONNECT 0x24
141#define DISCONNECT 0x25
142#define UNIT_INFO 0x30
143#define SUBUNIT_Info 0x31
144#define VENDOR 0x00
145
146#define PLUG_INFO 0x02
147#define OPEN_DESCRIPTOR 0x08
148#define READ_DESCRIPTOR 0x09
149#define OBJECT_NUMBER_SELECT 0x0D
150
151/*************************************************************
152 AVCTuner opcodes
153**************************************************************/
154
155#define DSIT 0xC8
156#define DSD 0xCB
157#define DESCRIPTOR_TUNER_STATUS 0x80
158#define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00
159
160/*************************************************************
161 AVCTuner list types
162**************************************************************/
163#define Multiplex_List 0x80
164#define Service_List 0x82
165
166/*************************************************************
167 AVCTuner object entries
168**************************************************************/
169#define Multiplex 0x80
170#define Service 0x82
171#define Service_with_specified_components 0x83
172#define Preferred_components 0x90
173#define Component 0x84
174
175/*************************************************************
176 Vendor-specific commands
177**************************************************************/
178
179// digital everywhere vendor ID
180#define SFE_VENDOR_DE_COMPANYID_0 0x00
181#define SFE_VENDOR_DE_COMPANYID_1 0x12
182#define SFE_VENDOR_DE_COMPANYID_2 0x87
183
184#define SFE_VENDOR_MAX_NR_COMPONENTS 0x4
185#define SFE_VENDOR_MAX_NR_SERVICES 0x3
186#define SFE_VENDOR_MAX_NR_DSD_ELEMENTS 0x10
187
188// vendor commands
189#define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL 0x0A
190#define SFE_VENDOR_OPCODE_LNB_CONTROL 0x52
191#define SFE_VENDOR_OPCODE_TUNE_QPSK 0x58 // QPSK command for DVB-S
192
193// TODO: following vendor specific commands needs to be implemented
194#define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION 0x00
195#define SFE_VENDOR_OPCODE_HOST2CA 0x56
196#define SFE_VENDOR_OPCODE_CA2HOST 0x57
197#define SFE_VENDOR_OPCODE_CISTATUS 0x59
198#define SFE_VENDOR_OPCODE_TUNE_QPSK2 0x60 // QPSK command for DVB-S2 devices
199
200
201//AVCTuner DVB identifier service_ID
202#define DVB 0x20
203
204/*************************************************************
205 AVC descriptor types
206**************************************************************/
207
208#define Subunit_Identifier_Descriptor 0x00
209#define Tuner_Status_Descriptor 0x80
210
211typedef struct {
212 BYTE Subunit_Type;
213 BYTE Max_Subunit_ID;
214} SUBUNIT_INFO;
215
216/*************************************************************
217
218 AVCTuner DVB object IDs are 6 byte long
219
220**************************************************************/
221
222typedef struct {
223 BYTE Byte0;
224 BYTE Byte1;
225 BYTE Byte2;
226 BYTE Byte3;
227 BYTE Byte4;
228 BYTE Byte5;
229}OBJECT_ID;
230
231/*************************************************************
232 MULIPLEX Structs
233**************************************************************/
234typedef struct
235{
236#ifdef __LITTLE_ENDIAN
237 BYTE RF_frequency_hByte:6;
238 BYTE raster_Frequency:2;//Bit7,6 raster frequency
239#else
240 BYTE raster_Frequency:2;
241 BYTE RF_frequency_hByte:6;
242#endif
243 BYTE RF_frequency_mByte;
244 BYTE RF_frequency_lByte;
245
246}FREQUENCY;
247
248#ifdef __LITTLE_ENDIAN
249
250typedef struct
251{
252 BYTE Modulation :1;
253 BYTE FEC_inner :1;
254 BYTE FEC_outer :1;
255 BYTE Symbol_Rate :1;
256 BYTE Frequency :1;
257 BYTE Orbital_Pos :1;
258 BYTE Polarisation :1;
259 BYTE reserved_fields :1;
260 BYTE reserved1 :7;
261 BYTE Network_ID :1;
262
263}MULTIPLEX_VALID_FLAGS;
264
265typedef struct
266{
267 BYTE GuardInterval:1;
268 BYTE CodeRateLPStream:1;
269 BYTE CodeRateHPStream:1;
270 BYTE HierarchyInfo:1;
271 BYTE Constellation:1;
272 BYTE Bandwidth:1;
273 BYTE CenterFrequency:1;
274 BYTE reserved1:1;
275 BYTE reserved2:5;
276 BYTE OtherFrequencyFlag:1;
277 BYTE TransmissionMode:1;
278 BYTE NetworkId:1;
279}MULTIPLEX_VALID_FLAGS_DVBT;
280
281#else
282
283typedef struct {
284 BYTE reserved_fields:1;
285 BYTE Polarisation:1;
286 BYTE Orbital_Pos:1;
287 BYTE Frequency:1;
288 BYTE Symbol_Rate:1;
289 BYTE FEC_outer:1;
290 BYTE FEC_inner:1;
291 BYTE Modulation:1;
292 BYTE Network_ID:1;
293 BYTE reserved1:7;
294}MULTIPLEX_VALID_FLAGS;
295
296typedef struct {
297 BYTE reserved1:1;
298 BYTE CenterFrequency:1;
299 BYTE Bandwidth:1;
300 BYTE Constellation:1;
301 BYTE HierarchyInfo:1;
302 BYTE CodeRateHPStream:1;
303 BYTE CodeRateLPStream:1;
304 BYTE GuardInterval:1;
305 BYTE NetworkId:1;
306 BYTE TransmissionMode:1;
307 BYTE OtherFrequencyFlag:1;
308 BYTE reserved2:5;
309}MULTIPLEX_VALID_FLAGS_DVBT;
310
311#endif
312
313typedef union {
314 MULTIPLEX_VALID_FLAGS Bits;
315 MULTIPLEX_VALID_FLAGS_DVBT Bits_T;
316 struct {
317 BYTE ByteHi;
318 BYTE ByteLo;
319 } Valid_Word;
320} M_VALID_FLAGS;
321
322typedef struct
323{
324#ifdef __LITTLE_ENDIAN
325 BYTE ActiveSystem;
326 BYTE reserved:5;
327 BYTE NoRF:1;
328 BYTE Moving:1;
329 BYTE Searching:1;
330
331 BYTE SelectedAntenna:7;
332 BYTE Input:1;
333
334 BYTE BER[4];
335
336 BYTE SignalStrength;
337 FREQUENCY Frequency;
338
339 BYTE ManDepInfoLength;
340#else
341 BYTE ActiveSystem;
342 BYTE Searching:1;
343 BYTE Moving:1;
344 BYTE NoRF:1;
345 BYTE reserved:5;
346
347 BYTE Input:1;
348 BYTE SelectedAntenna:7;
349
350 BYTE BER[4];
351
352 BYTE SignalStrength;
353 FREQUENCY Frequency;
354
355 BYTE ManDepInfoLength;
356#endif
357} ANTENNA_INPUT_INFO; // 11 Byte
358
359#define LNBCONTROL_DONTCARE 0xff
360
361
362extern int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm);
363extern int AVCRecv(struct firesat *firesat, u8 *data, size_t length);
364
365extern int AVCTuner_DSIT(struct firesat *firesat,
366 int Source_Plug,
367 struct dvb_frontend_parameters *params,
368 BYTE *status);
369
370extern int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_info);
371extern int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params, BYTE *status);
372extern int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]);
373extern int AVCTuner_GetTS(struct firesat *firesat);
374
375extern int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *transport, int *has_ci);
376extern int AVCLNBControl(struct firesat *firesat, char voltage, char burst, char conttone, char nrdiseq, struct dvb_diseqc_master_cmd *diseqcmd);
377extern int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount);
378extern int AVCRegisterRemoteControl(struct firesat *firesat);
379
380#endif
381