2 * ddbridge.h: Digital Devices PCIe bridge driver
4 * Copyright (C) 2010-2011 Digital Devices GmbH
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.
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.
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
21 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
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>
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>
41 #include "dvb_demux.h"
42 #include "dvb_frontend.h"
43 #include "dvb_ringbuffer.h"
44 #include "dvb_ca_en50221.h"
49 #define DDB_MAX_PORT 4
50 #define DDB_MAX_INPUT 8
51 #define DDB_MAX_OUTPUT 4
59 u32 port_type
[DDB_MAX_PORT
];
62 /* DMA_SIZE MUST be divisible by 188 and 128 !!! */
64 #define INPUT_DMA_MAX_BUFS 32 /* hardware table limit */
65 #define INPUT_DMA_BUFS 8
66 #define INPUT_DMA_SIZE (128*47*21)
68 #define OUTPUT_DMA_MAX_BUFS 32
69 #define OUTPUT_DMA_BUFS 8
70 #define OUTPUT_DMA_SIZE (128*47*21)
76 struct ddb_port
*port
;
80 dma_addr_t pbuf
[INPUT_DMA_MAX_BUFS
];
81 u8
*vbuf
[INPUT_DMA_MAX_BUFS
];
85 struct tasklet_struct tasklet
;
93 struct dvb_adapter adap
;
94 struct dvb_device
*dev
;
95 struct dvb_frontend
*fe
;
96 struct dvb_frontend
*fe2
;
98 struct dvb_demux demux
;
99 struct dvb_net dvbnet
;
100 struct dmx_frontend hw_frontend
;
101 struct dmx_frontend mem_frontend
;
103 int (*gate_ctrl
)(struct dvb_frontend
*, int);
107 struct ddb_port
*port
;
109 dma_addr_t pbuf
[OUTPUT_DMA_MAX_BUFS
];
110 u8
*vbuf
[OUTPUT_DMA_MAX_BUFS
];
113 struct tasklet_struct tasklet
;
115 wait_queue_head_t wq
;
121 struct dvb_adapter adap
;
122 struct dvb_device
*dev
;
128 struct i2c_adapter adap
;
129 struct i2c_adapter adap2
;
134 wait_queue_head_t wq
;
141 struct mutex i2c_gate_lock
;
143 #define DDB_PORT_NONE 0
144 #define DDB_PORT_CI 1
145 #define DDB_PORT_TUNER 2
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
154 struct ddb_input
*input
[2];
155 struct ddb_output
*output
;
156 struct dvb_ca_en50221
*en
;
160 struct pci_dev
*pdev
;
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
];
167 struct device
*ddb_dev
;
171 struct ddb_info
*info
;
175 /****************************************************************************/
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))
185 /****************************************************************************/