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 /*************************************************************
31 **************************************************************/
33 #define RESPONSE_REGISTER 0xFFFFF0000D00ULL
34 #define COMMAND_REGISTER 0xFFFFF0000B00ULL
35 #define PCR_BASE_ADDRESS 0xFFFFF0000900ULL
38 /************************************************************
39 definition of structures
40 *************************************************************/
43 int Nr_DestinationPlugs;
47 /***********************************************
51 ************************************************/
55 // FCP command frame with ctype = 0x0 is AVC command frame
57 #ifdef __LITTLE_ENDIAN
59 // Definition FCP Command Frame
60 typedef struct _AVCCmdFrm
63 __u8 ctype : 4 ; // command type
64 __u8 cts : 4 ; // always 0x0 for AVC
65 __u8 suid : 3 ; // subunit ID
66 __u8 sutyp : 5 ; // subunit_typ
67 __u8 opcode : 8 ; // opcode
68 __u8 operand[509] ; // array of operands [1-507]
69 int length; //length of the command frame
72 // Definition FCP Response Frame
73 typedef struct _AVCRspFrm
75 // AV/C response frame
76 __u8 resp : 4 ; // response type
77 __u8 cts : 4 ; // always 0x0 for AVC
78 __u8 suid : 3 ; // subunit ID
79 __u8 sutyp : 5 ; // subunit_typ
80 __u8 opcode : 8 ; // opcode
81 __u8 operand[509] ; // array of operands [1-507]
82 int length; //length of the response frame
87 typedef struct _AVCCmdFrm
98 typedef struct _AVCRspFrm
111 /*************************************************************
112 AVC command types (ctype)
113 **************************************************************///
119 /*************************************************************
121 **************************************************************///
122 #define NOT_IMPLEMENTED 0x8
129 /*************************************************************
131 **************************************************************///
133 #define DISCONNECT 0x25
134 #define UNIT_INFO 0x30
135 #define SUBUNIT_Info 0x31
138 #define PLUG_INFO 0x02
139 #define OPEN_DESCRIPTOR 0x08
140 #define READ_DESCRIPTOR 0x09
141 #define OBJECT_NUMBER_SELECT 0x0D
143 /*************************************************************
145 **************************************************************/
149 #define DESCRIPTOR_TUNER_STATUS 0x80
150 #define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00
152 /*************************************************************
154 **************************************************************/
155 #define Multiplex_List 0x80
156 #define Service_List 0x82
158 /*************************************************************
159 AVCTuner object entries
160 **************************************************************/
161 #define Multiplex 0x80
163 #define Service_with_specified_components 0x83
164 #define Preferred_components 0x90
165 #define Component 0x84
167 /*************************************************************
168 Vendor-specific commands
169 **************************************************************/
171 // digital everywhere vendor ID
172 #define SFE_VENDOR_DE_COMPANYID_0 0x00
173 #define SFE_VENDOR_DE_COMPANYID_1 0x12
174 #define SFE_VENDOR_DE_COMPANYID_2 0x87
176 #define SFE_VENDOR_MAX_NR_COMPONENTS 0x4
177 #define SFE_VENDOR_MAX_NR_SERVICES 0x3
178 #define SFE_VENDOR_MAX_NR_DSD_ELEMENTS 0x10
181 #define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL 0x0A
182 #define SFE_VENDOR_OPCODE_LNB_CONTROL 0x52
183 #define SFE_VENDOR_OPCODE_TUNE_QPSK 0x58 // QPSK command for DVB-S
185 // TODO: following vendor specific commands needs to be implemented
186 #define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION 0x00
187 #define SFE_VENDOR_OPCODE_HOST2CA 0x56
188 #define SFE_VENDOR_OPCODE_CA2HOST 0x57
189 #define SFE_VENDOR_OPCODE_CISTATUS 0x59
190 #define SFE_VENDOR_OPCODE_TUNE_QPSK2 0x60 // QPSK command for DVB-S2 devices
193 #define SFE_VENDOR_TAG_CA_RESET 0x00
194 #define SFE_VENDOR_TAG_CA_APPLICATION_INFO 0x01
195 #define SFE_VENDOR_TAG_CA_PMT 0x02
196 #define SFE_VENDOR_TAG_CA_DATE_TIME 0x04
197 #define SFE_VENDOR_TAG_CA_MMI 0x05
198 #define SFE_VENDOR_TAG_CA_ENTER_MENU 0x07
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 __u8 RF_frequency_hByte:6;
238 __u8 raster_Frequency:2;//Bit7,6 raster frequency
240 __u8 raster_Frequency:2;
241 __u8 RF_frequency_hByte:6;
243 __u8 RF_frequency_mByte;
244 __u8 RF_frequency_lByte;
248 #ifdef __LITTLE_ENDIAN
258 __u8 Polarisation :1;
259 __u8 reserved_fields :1;
263 }MULTIPLEX_VALID_FLAGS;
267 __u8 GuardInterval:1;
268 __u8 CodeRateLPStream:1;
269 __u8 CodeRateHPStream:1;
270 __u8 HierarchyInfo:1;
271 __u8 Constellation:1;
273 __u8 CenterFrequency:1;
276 __u8 OtherFrequencyFlag:1;
277 __u8 TransmissionMode:1;
279 }MULTIPLEX_VALID_FLAGS_DVBT;
284 __u8 reserved_fields:1;
294 }MULTIPLEX_VALID_FLAGS;
298 __u8 CenterFrequency:1;
300 __u8 Constellation:1;
301 __u8 HierarchyInfo:1;
302 __u8 CodeRateHPStream:1;
303 __u8 CodeRateLPStream:1;
304 __u8 GuardInterval:1;
306 __u8 TransmissionMode:1;
307 __u8 OtherFrequencyFlag:1;
309 }MULTIPLEX_VALID_FLAGS_DVBT;
314 MULTIPLEX_VALID_FLAGS Bits;
315 MULTIPLEX_VALID_FLAGS_DVBT Bits_T;
324 #ifdef __LITTLE_ENDIAN
331 __u8 SelectedAntenna:7;
339 __u8 ManDepInfoLength;
342 __u8 FrontEndPowerStatus:1;
345 __u8 FrontEndError:1;
348 __u8 CarrierNoiseRatio[2];
350 __u8 PowerSupplyVoltage;
352 __u8 FirewireBusVoltage;
358 __u8 CaInitializationStatus:1;
361 __u8 CaModulePresentStatus:1;
362 __u8 CaApplicationInfo:1;
363 __u8 CaDateTimeRequest:1;
374 __u8 SelectedAntenna:7;
381 __u8 ManDepInfoLength;
384 __u8 FrontEndError:1;
387 __u8 FrontEndPowerStatus:1;
390 __u8 CarrierNoiseRatio[2];
392 __u8 PowerSupplyVoltage;
394 __u8 FirewireBusVoltage;
399 __u8 CaDateTimeRequest:1;
400 __u8 CaApplicationInfo:1;
401 __u8 CaModulePresentStatus:1;
404 __u8 CaInitializationStatus:1;
408 } ANTENNA_INPUT_INFO; // 22 Byte
410 #define LNBCONTROL_DONTCARE 0xff
412 struct dvb_diseqc_master_cmd;
413 struct dvb_frontend_parameters;
416 int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm,
418 int AVCRecv(struct firesat *firesat, u8 *data, size_t length);
420 int AVCTuner_DSIT(struct firesat *firesat, int Source_Plug,
421 struct dvb_frontend_parameters *params, __u8 *status);
423 int AVCTunerStatus(struct firesat *firesat,
424 ANTENNA_INPUT_INFO *antenna_input_info);
425 int AVCTuner_DSD(struct firesat *firesat,
426 struct dvb_frontend_parameters *params, __u8 *status);
427 int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]);
428 int AVCTuner_GetTS(struct firesat *firesat);
430 int AVCIdentifySubunit(struct firesat *firesat);
431 int AVCLNBControl(struct firesat *firesat, char voltage, char burst,
432 char conttone, char nrdiseq,
433 struct dvb_diseqc_master_cmd *diseqcmd);
434 int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount);
435 void avc_remote_ctrl_work(struct work_struct *work);
436 int AVCRegisterRemoteControl(struct firesat *firesat);
437 int AVCTuner_Host2Ca(struct firesat *firesat);
438 int avc_ca_app_info(struct firesat *firesat, char *app_info, int *length);
439 int avc_ca_info(struct firesat *firesat, char *app_info, int *length);
440 int avc_ca_reset(struct firesat *firesat);
441 int avc_ca_pmt(struct firesat *firesat, char *app_info, int length);
442 int avc_ca_get_time_date(struct firesat *firesat, int *interval);
443 int avc_ca_enter_menu(struct firesat *firesat);
444 int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, int *length);
446 #endif /* _AVC_API_H */