1 /***************************************************************************
2 avc_api.h - description
5 copyright : (C) 2000 by Manfred Weihs
6 copyright : (C) 2003 by Philipp Gutgsell
7 email : 0014guph@edu.fh-kaernten.ac.at
8 ***************************************************************************/
10 /***************************************************************************
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. *
17 ***************************************************************************/
20 This is based on code written by Peter Halwachs,
21 Thomas Groiss and Andreas Monitzer.
28 #include <linux/dvb/frontend.h>
30 #define BYTE unsigned char
31 #define WORD unsigned short
32 #define DWORD unsigned long
33 #define ULONG unsigned long
37 /*************************************************************
39 **************************************************************/
41 #define RESPONSE_REGISTER 0xFFFFF0000D00ULL
42 #define COMMAND_REGISTER 0xFFFFF0000B00ULL
43 #define PCR_BASE_ADDRESS 0xFFFFF0000900ULL
46 /************************************************************
47 definition of structures
48 *************************************************************/
51 int Nr_DestinationPlugs
;
55 /***********************************************
59 ************************************************/
63 // FCP command frame with ctype = 0x0 is AVC command frame
65 #ifdef __LITTLE_ENDIAN
67 // Definition FCP Command Frame
68 typedef struct _AVCCmdFrm
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
80 // Definition FCP Response Frame
81 typedef struct _AVCRspFrm
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
95 typedef struct _AVCCmdFrm
106 typedef struct _AVCRspFrm
119 /*************************************************************
120 AVC command types (ctype)
121 **************************************************************///
127 /*************************************************************
129 **************************************************************///
130 #define NOT_IMPLEMENTED 0x8
137 /*************************************************************
139 **************************************************************///
141 #define DISCONNECT 0x25
142 #define UNIT_INFO 0x30
143 #define SUBUNIT_Info 0x31
146 #define PLUG_INFO 0x02
147 #define OPEN_DESCRIPTOR 0x08
148 #define READ_DESCRIPTOR 0x09
149 #define OBJECT_NUMBER_SELECT 0x0D
151 /*************************************************************
153 **************************************************************/
157 #define DESCRIPTOR_TUNER_STATUS 0x80
158 #define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00
160 /*************************************************************
162 **************************************************************/
163 #define Multiplex_List 0x80
164 #define Service_List 0x82
166 /*************************************************************
167 AVCTuner object entries
168 **************************************************************/
169 #define Multiplex 0x80
171 #define Service_with_specified_components 0x83
172 #define Preferred_components 0x90
173 #define Component 0x84
175 /*************************************************************
176 Vendor-specific commands
177 **************************************************************/
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
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
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
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
201 //AVCTuner DVB identifier service_ID
204 /*************************************************************
206 **************************************************************/
208 #define Subunit_Identifier_Descriptor 0x00
209 #define Tuner_Status_Descriptor 0x80
216 /*************************************************************
218 AVCTuner DVB object IDs are 6 byte long
220 **************************************************************/
231 /*************************************************************
233 **************************************************************/
236 #ifdef __LITTLE_ENDIAN
237 BYTE RF_frequency_hByte
:6;
238 BYTE raster_Frequency
:2;//Bit7,6 raster frequency
240 BYTE raster_Frequency
:2;
241 BYTE RF_frequency_hByte
:6;
243 BYTE RF_frequency_mByte
;
244 BYTE RF_frequency_lByte
;
248 #ifdef __LITTLE_ENDIAN
258 BYTE Polarisation
:1;
259 BYTE reserved_fields
:1;
263 }MULTIPLEX_VALID_FLAGS
;
267 BYTE GuardInterval
:1;
268 BYTE CodeRateLPStream
:1;
269 BYTE CodeRateHPStream
:1;
270 BYTE HierarchyInfo
:1;
271 BYTE Constellation
:1;
273 BYTE CenterFrequency
:1;
276 BYTE OtherFrequencyFlag
:1;
277 BYTE TransmissionMode
:1;
279 }MULTIPLEX_VALID_FLAGS_DVBT
;
284 BYTE reserved_fields
:1;
294 }MULTIPLEX_VALID_FLAGS
;
298 BYTE CenterFrequency
:1;
300 BYTE Constellation
:1;
301 BYTE HierarchyInfo
:1;
302 BYTE CodeRateHPStream
:1;
303 BYTE CodeRateLPStream
:1;
304 BYTE GuardInterval
:1;
306 BYTE TransmissionMode
:1;
307 BYTE OtherFrequencyFlag
:1;
309 }MULTIPLEX_VALID_FLAGS_DVBT
;
314 MULTIPLEX_VALID_FLAGS Bits
;
315 MULTIPLEX_VALID_FLAGS_DVBT Bits_T
;
324 #ifdef __LITTLE_ENDIAN
331 BYTE SelectedAntenna
:7;
339 BYTE ManDepInfoLength
;
348 BYTE SelectedAntenna
:7;
355 BYTE ManDepInfoLength
;
357 } ANTENNA_INPUT_INFO
; // 11 Byte
359 #define LNBCONTROL_DONTCARE 0xff
362 extern int AVCWrite(struct firesat
*firesat
, const AVCCmdFrm
*CmdFrm
, AVCRspFrm
*RspFrm
);
363 extern int AVCRecv(struct firesat
*firesat
, u8
*data
, size_t length
);
365 extern int AVCTuner_DSIT(struct firesat
*firesat
,
367 struct dvb_frontend_parameters
*params
,
370 extern int AVCTunerStatus(struct firesat
*firesat
, ANTENNA_INPUT_INFO
*antenna_input_info
);
371 extern int AVCTuner_DSD(struct firesat
*firesat
, struct dvb_frontend_parameters
*params
, BYTE
*status
);
372 extern int AVCTuner_SetPIDs(struct firesat
*firesat
, unsigned char pidc
, u16 pid
[]);
373 extern int AVCTuner_GetTS(struct firesat
*firesat
);
375 extern int AVCIdentifySubunit(struct firesat
*firesat
, unsigned char *systemId
, int *transport
, int *has_ci
);
376 extern int AVCLNBControl(struct firesat
*firesat
, char voltage
, char burst
, char conttone
, char nrdiseq
, struct dvb_diseqc_master_cmd
*diseqcmd
);
377 extern int AVCSubUnitInfo(struct firesat
*firesat
, char *subunitcount
);
378 extern int AVCRegisterRemoteControl(struct firesat
*firesat
);