4 * Copyright (C) 2000 Manfred Weihs
5 * Copyright (C) 2003 Philipp Gutgsell <0014guph@edu.fh-kaernten.ac.at>
6 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
7 * Copyright (C) 2008 Ben Backx <ben@bbackx.com>
8 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
10 * This is based on code written by Peter Halwachs, Thomas Groiss and
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
22 #include <linux/types.h>
24 /*************************************************************
25 Constants from EN510221
26 **************************************************************/
27 #define LIST_MANAGEMENT_ONLY 0x03
29 /************************************************************
30 definition of structures
31 *************************************************************/
34 int Nr_DestinationPlugs
;
38 /***********************************************
42 ************************************************/
46 // FCP command frame with ctype = 0x0 is AVC command frame
48 #ifdef __LITTLE_ENDIAN
50 // Definition FCP Command Frame
51 typedef struct _AVCCmdFrm
54 __u8 ctype
: 4 ; // command type
55 __u8 cts
: 4 ; // always 0x0 for AVC
56 __u8 suid
: 3 ; // subunit ID
57 __u8 sutyp
: 5 ; // subunit_typ
58 __u8 opcode
: 8 ; // opcode
59 __u8 operand
[509] ; // array of operands [1-507]
60 int length
; //length of the command frame
63 // Definition FCP Response Frame
64 typedef struct _AVCRspFrm
66 // AV/C response frame
67 __u8 resp
: 4 ; // response type
68 __u8 cts
: 4 ; // always 0x0 for AVC
69 __u8 suid
: 3 ; // subunit ID
70 __u8 sutyp
: 5 ; // subunit_typ
71 __u8 opcode
: 8 ; // opcode
72 __u8 operand
[509] ; // array of operands [1-507]
73 int length
; //length of the response frame
78 typedef struct _AVCCmdFrm
89 typedef struct _AVCRspFrm
102 /*************************************************************
103 AVC command types (ctype)
104 **************************************************************///
110 /*************************************************************
112 **************************************************************///
113 #define NOT_IMPLEMENTED 0x8
120 /*************************************************************
122 **************************************************************///
124 #define DISCONNECT 0x25
125 #define UNIT_INFO 0x30
126 #define SUBUNIT_Info 0x31
129 #define PLUG_INFO 0x02
130 #define OPEN_DESCRIPTOR 0x08
131 #define READ_DESCRIPTOR 0x09
132 #define OBJECT_NUMBER_SELECT 0x0D
134 /*************************************************************
136 **************************************************************/
140 #define DESCRIPTOR_TUNER_STATUS 0x80
141 #define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00
143 /*************************************************************
145 **************************************************************/
146 #define Multiplex_List 0x80
147 #define Service_List 0x82
149 /*************************************************************
150 AVCTuner object entries
151 **************************************************************/
152 #define Multiplex 0x80
154 #define Service_with_specified_components 0x83
155 #define Preferred_components 0x90
156 #define Component 0x84
158 /*************************************************************
159 Vendor-specific commands
160 **************************************************************/
162 // digital everywhere vendor ID
163 #define SFE_VENDOR_DE_COMPANYID_0 0x00
164 #define SFE_VENDOR_DE_COMPANYID_1 0x12
165 #define SFE_VENDOR_DE_COMPANYID_2 0x87
167 #define SFE_VENDOR_MAX_NR_COMPONENTS 0x4
168 #define SFE_VENDOR_MAX_NR_SERVICES 0x3
169 #define SFE_VENDOR_MAX_NR_DSD_ELEMENTS 0x10
172 #define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL 0x0A
173 #define SFE_VENDOR_OPCODE_LNB_CONTROL 0x52
174 #define SFE_VENDOR_OPCODE_TUNE_QPSK 0x58 // QPSK command for DVB-S
176 // TODO: following vendor specific commands needs to be implemented
177 #define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION 0x00
178 #define SFE_VENDOR_OPCODE_HOST2CA 0x56
179 #define SFE_VENDOR_OPCODE_CA2HOST 0x57
180 #define SFE_VENDOR_OPCODE_CISTATUS 0x59
181 #define SFE_VENDOR_OPCODE_TUNE_QPSK2 0x60 // QPSK command for DVB-S2 devices
184 #define SFE_VENDOR_TAG_CA_RESET 0x00
185 #define SFE_VENDOR_TAG_CA_APPLICATION_INFO 0x01
186 #define SFE_VENDOR_TAG_CA_PMT 0x02
187 #define SFE_VENDOR_TAG_CA_DATE_TIME 0x04
188 #define SFE_VENDOR_TAG_CA_MMI 0x05
189 #define SFE_VENDOR_TAG_CA_ENTER_MENU 0x07
192 //AVCTuner DVB identifier service_ID
195 /*************************************************************
197 **************************************************************/
199 #define Subunit_Identifier_Descriptor 0x00
200 #define Tuner_Status_Descriptor 0x80
207 /*************************************************************
209 AVCTuner DVB object IDs are 6 byte long
211 **************************************************************/
222 /*************************************************************
224 **************************************************************/
227 #ifdef __LITTLE_ENDIAN
228 __u8 RF_frequency_hByte
:6;
229 __u8 raster_Frequency
:2;//Bit7,6 raster frequency
231 __u8 raster_Frequency
:2;
232 __u8 RF_frequency_hByte
:6;
234 __u8 RF_frequency_mByte
;
235 __u8 RF_frequency_lByte
;
239 #ifdef __LITTLE_ENDIAN
249 __u8 Polarisation
:1;
250 __u8 reserved_fields
:1;
254 }MULTIPLEX_VALID_FLAGS
;
258 __u8 GuardInterval
:1;
259 __u8 CodeRateLPStream
:1;
260 __u8 CodeRateHPStream
:1;
261 __u8 HierarchyInfo
:1;
262 __u8 Constellation
:1;
264 __u8 CenterFrequency
:1;
267 __u8 OtherFrequencyFlag
:1;
268 __u8 TransmissionMode
:1;
270 }MULTIPLEX_VALID_FLAGS_DVBT
;
275 __u8 reserved_fields
:1;
285 }MULTIPLEX_VALID_FLAGS
;
289 __u8 CenterFrequency
:1;
291 __u8 Constellation
:1;
292 __u8 HierarchyInfo
:1;
293 __u8 CodeRateHPStream
:1;
294 __u8 CodeRateLPStream
:1;
295 __u8 GuardInterval
:1;
297 __u8 TransmissionMode
:1;
298 __u8 OtherFrequencyFlag
:1;
300 }MULTIPLEX_VALID_FLAGS_DVBT
;
305 MULTIPLEX_VALID_FLAGS Bits
;
306 MULTIPLEX_VALID_FLAGS_DVBT Bits_T
;
315 #ifdef __LITTLE_ENDIAN
322 __u8 SelectedAntenna
:7;
330 __u8 ManDepInfoLength
;
333 __u8 FrontEndPowerStatus
:1;
336 __u8 FrontEndError
:1;
339 __u8 CarrierNoiseRatio
[2];
341 __u8 PowerSupplyVoltage
;
343 __u8 FirewireBusVoltage
;
349 __u8 CaInitializationStatus
:1;
352 __u8 CaModulePresentStatus
:1;
353 __u8 CaApplicationInfo
:1;
354 __u8 CaDateTimeRequest
:1;
365 __u8 SelectedAntenna
:7;
372 __u8 ManDepInfoLength
;
375 __u8 FrontEndError
:1;
378 __u8 FrontEndPowerStatus
:1;
381 __u8 CarrierNoiseRatio
[2];
383 __u8 PowerSupplyVoltage
;
385 __u8 FirewireBusVoltage
;
390 __u8 CaDateTimeRequest
:1;
391 __u8 CaApplicationInfo
:1;
392 __u8 CaModulePresentStatus
:1;
395 __u8 CaInitializationStatus
:1;
399 } ANTENNA_INPUT_INFO
; // 22 Byte
401 #define LNBCONTROL_DONTCARE 0xff
403 struct dvb_diseqc_master_cmd
;
404 struct dvb_frontend_parameters
;
407 int avc_recv(struct firesat
*firesat
, u8
*data
, size_t length
);
409 int AVCTuner_DSIT(struct firesat
*firesat
, int Source_Plug
,
410 struct dvb_frontend_parameters
*params
, __u8
*status
);
412 int avc_tuner_status(struct firesat
*firesat
,
413 ANTENNA_INPUT_INFO
*antenna_input_info
);
414 int avc_tuner_dsd(struct firesat
*firesat
,
415 struct dvb_frontend_parameters
*params
);
416 int avc_tuner_set_pids(struct firesat
*firesat
, unsigned char pidc
, u16 pid
[]);
417 int avc_tuner_get_ts(struct firesat
*firesat
);
418 int avc_identify_subunit(struct firesat
*firesat
);
419 int avc_lnb_control(struct firesat
*firesat
, char voltage
, char burst
,
420 char conttone
, char nrdiseq
,
421 struct dvb_diseqc_master_cmd
*diseqcmd
);
422 void avc_remote_ctrl_work(struct work_struct
*work
);
423 int avc_register_remote_control(struct firesat
*firesat
);
424 int avc_ca_app_info(struct firesat
*firesat
, char *app_info
, unsigned int *len
);
425 int avc_ca_info(struct firesat
*firesat
, char *app_info
, unsigned int *len
);
426 int avc_ca_reset(struct firesat
*firesat
);
427 int avc_ca_pmt(struct firesat
*firesat
, char *app_info
, int length
);
428 int avc_ca_get_time_date(struct firesat
*firesat
, int *interval
);
429 int avc_ca_enter_menu(struct firesat
*firesat
);
430 int avc_ca_get_mmi(struct firesat
*firesat
, char *mmi_object
, unsigned int *len
);
432 #endif /* _AVC_API_H */