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/socket.h>
39 #include "dvb_demux.h"
40 #include "dvb_frontend.h"
41 #include "dvb_ringbuffer.h"
42 #include "dvb_ca_en50221.h"
47 #define DDB_MAX_PORT 4
48 #define DDB_MAX_INPUT 8
49 #define DDB_MAX_OUTPUT 4
57 u32 port_type
[DDB_MAX_PORT
];
60 /* DMA_SIZE MUST be divisible by 188 and 128 !!! */
62 #define INPUT_DMA_MAX_BUFS 32 /* hardware table limit */
63 #define INPUT_DMA_BUFS 8
64 #define INPUT_DMA_SIZE (128*47*21)
66 #define OUTPUT_DMA_MAX_BUFS 32
67 #define OUTPUT_DMA_BUFS 8
68 #define OUTPUT_DMA_SIZE (128*47*21)
74 struct ddb_port
*port
;
78 dma_addr_t pbuf
[INPUT_DMA_MAX_BUFS
];
79 u8
*vbuf
[INPUT_DMA_MAX_BUFS
];
83 struct tasklet_struct tasklet
;
91 struct dvb_adapter adap
;
92 struct dvb_device
*dev
;
93 struct dvb_frontend
*fe
;
94 struct dvb_frontend
*fe2
;
96 struct dvb_demux demux
;
97 struct dvb_net dvbnet
;
98 struct dmx_frontend hw_frontend
;
99 struct dmx_frontend mem_frontend
;
101 int (*gate_ctrl
)(struct dvb_frontend
*, int);
105 struct ddb_port
*port
;
107 dma_addr_t pbuf
[OUTPUT_DMA_MAX_BUFS
];
108 u8
*vbuf
[OUTPUT_DMA_MAX_BUFS
];
111 struct tasklet_struct tasklet
;
113 wait_queue_head_t wq
;
119 struct dvb_adapter adap
;
120 struct dvb_device
*dev
;
126 struct i2c_adapter adap
;
127 struct i2c_adapter adap2
;
132 wait_queue_head_t wq
;
139 struct mutex i2c_gate_lock
;
141 #define DDB_PORT_NONE 0
142 #define DDB_PORT_CI 1
143 #define DDB_PORT_TUNER 2
145 #define DDB_TUNER_NONE 0
146 #define DDB_TUNER_DVBS_ST 1
147 #define DDB_TUNER_DVBS_ST_AA 2
148 #define DDB_TUNER_DVBCT_TR 16
149 #define DDB_TUNER_DVBCT_ST 17
152 struct ddb_input
*input
[2];
153 struct ddb_output
*output
;
154 struct dvb_ca_en50221
*en
;
158 struct pci_dev
*pdev
;
160 struct ddb_port port
[DDB_MAX_PORT
];
161 struct ddb_i2c i2c
[DDB_MAX_I2C
];
162 struct ddb_input input
[DDB_MAX_INPUT
];
163 struct ddb_output output
[DDB_MAX_OUTPUT
];
165 struct device
*ddb_dev
;
169 struct ddb_info
*info
;
173 /****************************************************************************/
175 #define ddbwritel(_val, _adr) writel((_val), \
176 (char *) (dev->regs+(_adr)))
177 #define ddbreadl(_adr) readl((char *) (dev->regs+(_adr)))
178 #define ddbcpyto(_adr, _src, _count) memcpy_toio((char *) \
179 (dev->regs+(_adr)), (_src), (_count))
180 #define ddbcpyfrom(_dst, _adr, _count) memcpy_fromio((_dst), (char *) \
181 (dev->regs+(_adr)), (_count))
183 /****************************************************************************/