diff options
Diffstat (limited to 'drivers/media/dvb/bt8xx/dst_common.h')
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_common.h | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h new file mode 100644 index 000000000000..10046d6292b7 --- /dev/null +++ b/drivers/media/dvb/bt8xx/dst_common.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | Frontend-driver for TwinHan DST Frontend | ||
3 | |||
4 | Copyright (C) 2003 Jamie Honan | ||
5 | Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com) | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef DST_COMMON_H | ||
23 | #define DST_COMMON_H | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/device.h> | ||
27 | #include "bt878.h" | ||
28 | |||
29 | #include "dst_ca.h" | ||
30 | |||
31 | |||
32 | #define NO_DELAY 0 | ||
33 | #define LONG_DELAY 1 | ||
34 | #define DEVICE_INIT 2 | ||
35 | |||
36 | #define DELAY 1 | ||
37 | |||
38 | #define DST_TYPE_IS_SAT 0 | ||
39 | #define DST_TYPE_IS_TERR 1 | ||
40 | #define DST_TYPE_IS_CABLE 2 | ||
41 | #define DST_TYPE_IS_ATSC 3 | ||
42 | |||
43 | #define DST_TYPE_HAS_NEWTUNE 1 | ||
44 | #define DST_TYPE_HAS_TS204 2 | ||
45 | #define DST_TYPE_HAS_SYMDIV 4 | ||
46 | #define DST_TYPE_HAS_FW_1 8 | ||
47 | #define DST_TYPE_HAS_FW_2 16 | ||
48 | #define DST_TYPE_HAS_FW_3 32 | ||
49 | |||
50 | |||
51 | |||
52 | /* Card capability list */ | ||
53 | |||
54 | #define DST_TYPE_HAS_MAC 1 | ||
55 | #define DST_TYPE_HAS_DISEQC3 2 | ||
56 | #define DST_TYPE_HAS_DISEQC4 4 | ||
57 | #define DST_TYPE_HAS_DISEQC5 8 | ||
58 | #define DST_TYPE_HAS_MOTO 16 | ||
59 | #define DST_TYPE_HAS_CA 32 | ||
60 | #define DST_TYPE_HAS_ANALOG 64 /* Analog inputs */ | ||
61 | |||
62 | |||
63 | #define RDC_8820_PIO_0_DISABLE 0 | ||
64 | #define RDC_8820_PIO_0_ENABLE 1 | ||
65 | #define RDC_8820_INT 2 | ||
66 | #define RDC_8820_RESET 4 | ||
67 | |||
68 | /* DST Communication */ | ||
69 | #define GET_REPLY 1 | ||
70 | #define NO_REPLY 0 | ||
71 | |||
72 | #define GET_ACK 1 | ||
73 | #define FIXED_COMM 8 | ||
74 | |||
75 | #define ACK 0xff | ||
76 | |||
77 | struct dst_state { | ||
78 | |||
79 | struct i2c_adapter* i2c; | ||
80 | |||
81 | struct bt878* bt; | ||
82 | |||
83 | struct dvb_frontend_ops ops; | ||
84 | |||
85 | /* configuration settings */ | ||
86 | const struct dst_config* config; | ||
87 | |||
88 | struct dvb_frontend frontend; | ||
89 | |||
90 | /* private ASIC data */ | ||
91 | u8 tx_tuna[10]; | ||
92 | u8 rx_tuna[10]; | ||
93 | u8 rxbuffer[10]; | ||
94 | u8 diseq_flags; | ||
95 | u8 dst_type; | ||
96 | u32 type_flags; | ||
97 | u32 frequency; /* intermediate frequency in kHz for QPSK */ | ||
98 | fe_spectral_inversion_t inversion; | ||
99 | u32 symbol_rate; /* symbol rate in Symbols per second */ | ||
100 | fe_code_rate_t fec; | ||
101 | fe_sec_voltage_t voltage; | ||
102 | fe_sec_tone_mode_t tone; | ||
103 | u32 decode_freq; | ||
104 | u8 decode_lock; | ||
105 | u16 decode_strength; | ||
106 | u16 decode_snr; | ||
107 | unsigned long cur_jiff; | ||
108 | u8 k22; | ||
109 | fe_bandwidth_t bandwidth; | ||
110 | u8 dst_hw_cap; | ||
111 | u8 dst_fw_version; | ||
112 | fe_sec_mini_cmd_t minicmd; | ||
113 | u8 messages[256]; | ||
114 | }; | ||
115 | |||
116 | struct dst_types { | ||
117 | char *device_id; | ||
118 | int offset; | ||
119 | u8 dst_type; | ||
120 | u32 type_flags; | ||
121 | u8 dst_feature; | ||
122 | }; | ||
123 | |||
124 | |||
125 | |||
126 | struct dst_config | ||
127 | { | ||
128 | /* the ASIC i2c address */ | ||
129 | u8 demod_address; | ||
130 | }; | ||
131 | |||
132 | |||
133 | int rdc_reset_state(struct dst_state *state); | ||
134 | int rdc_8820_reset(struct dst_state *state); | ||
135 | |||
136 | int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode); | ||
137 | int dst_pio_enable(struct dst_state *state); | ||
138 | int dst_pio_disable(struct dst_state *state); | ||
139 | int dst_error_recovery(struct dst_state* state); | ||
140 | int dst_error_bailout(struct dst_state *state); | ||
141 | int dst_comm_init(struct dst_state* state); | ||
142 | |||
143 | int write_dst(struct dst_state *state, u8 * data, u8 len); | ||
144 | int read_dst(struct dst_state *state, u8 * ret, u8 len); | ||
145 | u8 dst_check_sum(u8 * buf, u32 len); | ||
146 | struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter); | ||
147 | int dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter); | ||
148 | int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay); | ||
149 | |||
150 | int dst_command(struct dst_state* state, u8 * data, u8 len); | ||
151 | |||
152 | |||
153 | #endif // DST_COMMON_H | ||