diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/media/dvb/ddbridge/ddbridge.h | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'drivers/media/dvb/ddbridge/ddbridge.h')
-rw-r--r-- | drivers/media/dvb/ddbridge/ddbridge.h | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/drivers/media/dvb/ddbridge/ddbridge.h b/drivers/media/dvb/ddbridge/ddbridge.h new file mode 100644 index 00000000000..6d14893218f --- /dev/null +++ b/drivers/media/dvb/ddbridge/ddbridge.h | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * ddbridge.h: Digital Devices PCIe bridge driver | ||
3 | * | ||
4 | * Copyright (C) 2010-2011 Digital Devices GmbH | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 only, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA | ||
21 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
22 | */ | ||
23 | |||
24 | #ifndef _DDBRIDGE_H_ | ||
25 | #define _DDBRIDGE_H_ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/sched.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/i2c.h> | ||
31 | #include <linux/mutex.h> | ||
32 | #include <asm/dma.h> | ||
33 | #include <linux/dvb/frontend.h> | ||
34 | #include <linux/dvb/ca.h> | ||
35 | #include <linux/dvb/video.h> | ||
36 | #include <linux/dvb/audio.h> | ||
37 | #include <linux/socket.h> | ||
38 | |||
39 | #include "dmxdev.h" | ||
40 | #include "dvbdev.h" | ||
41 | #include "dvb_demux.h" | ||
42 | #include "dvb_frontend.h" | ||
43 | #include "dvb_ringbuffer.h" | ||
44 | #include "dvb_ca_en50221.h" | ||
45 | #include "dvb_net.h" | ||
46 | #include "cxd2099.h" | ||
47 | |||
48 | #define DDB_MAX_I2C 4 | ||
49 | #define DDB_MAX_PORT 4 | ||
50 | #define DDB_MAX_INPUT 8 | ||
51 | #define DDB_MAX_OUTPUT 4 | ||
52 | |||
53 | struct ddb_info { | ||
54 | int type; | ||
55 | #define DDB_NONE 0 | ||
56 | #define DDB_OCTOPUS 1 | ||
57 | char *name; | ||
58 | int port_num; | ||
59 | u32 port_type[DDB_MAX_PORT]; | ||
60 | }; | ||
61 | |||
62 | /* DMA_SIZE MUST be divisible by 188 and 128 !!! */ | ||
63 | |||
64 | #define INPUT_DMA_MAX_BUFS 32 /* hardware table limit */ | ||
65 | #define INPUT_DMA_BUFS 8 | ||
66 | #define INPUT_DMA_SIZE (128*47*21) | ||
67 | |||
68 | #define OUTPUT_DMA_MAX_BUFS 32 | ||
69 | #define OUTPUT_DMA_BUFS 8 | ||
70 | #define OUTPUT_DMA_SIZE (128*47*21) | ||
71 | |||
72 | struct ddb; | ||
73 | struct ddb_port; | ||
74 | |||
75 | struct ddb_input { | ||
76 | struct ddb_port *port; | ||
77 | u32 nr; | ||
78 | int attached; | ||
79 | |||
80 | dma_addr_t pbuf[INPUT_DMA_MAX_BUFS]; | ||
81 | u8 *vbuf[INPUT_DMA_MAX_BUFS]; | ||
82 | u32 dma_buf_num; | ||
83 | u32 dma_buf_size; | ||
84 | |||
85 | struct tasklet_struct tasklet; | ||
86 | spinlock_t lock; | ||
87 | wait_queue_head_t wq; | ||
88 | int running; | ||
89 | u32 stat; | ||
90 | u32 cbuf; | ||
91 | u32 coff; | ||
92 | |||
93 | struct dvb_adapter adap; | ||
94 | struct dvb_device *dev; | ||
95 | struct dvb_frontend *fe; | ||
96 | struct dvb_frontend *fe2; | ||
97 | struct dmxdev dmxdev; | ||
98 | struct dvb_demux demux; | ||
99 | struct dvb_net dvbnet; | ||
100 | struct dmx_frontend hw_frontend; | ||
101 | struct dmx_frontend mem_frontend; | ||
102 | int users; | ||
103 | int (*gate_ctrl)(struct dvb_frontend *, int); | ||
104 | }; | ||
105 | |||
106 | struct ddb_output { | ||
107 | struct ddb_port *port; | ||
108 | u32 nr; | ||
109 | dma_addr_t pbuf[OUTPUT_DMA_MAX_BUFS]; | ||
110 | u8 *vbuf[OUTPUT_DMA_MAX_BUFS]; | ||
111 | u32 dma_buf_num; | ||
112 | u32 dma_buf_size; | ||
113 | struct tasklet_struct tasklet; | ||
114 | spinlock_t lock; | ||
115 | wait_queue_head_t wq; | ||
116 | int running; | ||
117 | u32 stat; | ||
118 | u32 cbuf; | ||
119 | u32 coff; | ||
120 | |||
121 | struct dvb_adapter adap; | ||
122 | struct dvb_device *dev; | ||
123 | }; | ||
124 | |||
125 | struct ddb_i2c { | ||
126 | struct ddb *dev; | ||
127 | u32 nr; | ||
128 | struct i2c_adapter adap; | ||
129 | struct i2c_adapter adap2; | ||
130 | u32 regs; | ||
131 | u32 rbuf; | ||
132 | u32 wbuf; | ||
133 | int done; | ||
134 | wait_queue_head_t wq; | ||
135 | }; | ||
136 | |||
137 | struct ddb_port { | ||
138 | struct ddb *dev; | ||
139 | u32 nr; | ||
140 | struct ddb_i2c *i2c; | ||
141 | struct mutex i2c_gate_lock; | ||
142 | u32 class; | ||
143 | #define DDB_PORT_NONE 0 | ||
144 | #define DDB_PORT_CI 1 | ||
145 | #define DDB_PORT_TUNER 2 | ||
146 | u32 type; | ||
147 | #define DDB_TUNER_NONE 0 | ||
148 | #define DDB_TUNER_DVBS_ST 1 | ||
149 | #define DDB_TUNER_DVBS_ST_AA 2 | ||
150 | #define DDB_TUNER_DVBCT_TR 16 | ||
151 | #define DDB_TUNER_DVBCT_ST 17 | ||
152 | u32 adr; | ||
153 | |||
154 | struct ddb_input *input[2]; | ||
155 | struct ddb_output *output; | ||
156 | struct dvb_ca_en50221 *en; | ||
157 | }; | ||
158 | |||
159 | struct ddb { | ||
160 | struct pci_dev *pdev; | ||
161 | unsigned char *regs; | ||
162 | struct ddb_port port[DDB_MAX_PORT]; | ||
163 | struct ddb_i2c i2c[DDB_MAX_I2C]; | ||
164 | struct ddb_input input[DDB_MAX_INPUT]; | ||
165 | struct ddb_output output[DDB_MAX_OUTPUT]; | ||
166 | |||
167 | struct device *ddb_dev; | ||
168 | int nr; | ||
169 | u8 iobuf[1028]; | ||
170 | |||
171 | struct ddb_info *info; | ||
172 | int msi; | ||
173 | }; | ||
174 | |||
175 | /****************************************************************************/ | ||
176 | |||
177 | #define ddbwritel(_val, _adr) writel((_val), \ | ||
178 | (char *) (dev->regs+(_adr))) | ||
179 | #define ddbreadl(_adr) readl((char *) (dev->regs+(_adr))) | ||
180 | #define ddbcpyto(_adr, _src, _count) memcpy_toio((char *) \ | ||
181 | (dev->regs+(_adr)), (_src), (_count)) | ||
182 | #define ddbcpyfrom(_dst, _adr, _count) memcpy_fromio((_dst), (char *) \ | ||
183 | (dev->regs+(_adr)), (_count)) | ||
184 | |||
185 | /****************************************************************************/ | ||
186 | |||
187 | #endif | ||