Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ddbridge.h
Go to the documentation of this file.
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/socket.h>
36 
37 #include "dmxdev.h"
38 #include "dvbdev.h"
39 #include "dvb_demux.h"
40 #include "dvb_frontend.h"
41 #include "dvb_ringbuffer.h"
42 #include "dvb_ca_en50221.h"
43 #include "dvb_net.h"
44 #include "cxd2099.h"
45 
46 #define DDB_MAX_I2C 4
47 #define DDB_MAX_PORT 4
48 #define DDB_MAX_INPUT 8
49 #define DDB_MAX_OUTPUT 4
50 
51 struct ddb_info {
52  int type;
53 #define DDB_NONE 0
54 #define DDB_OCTOPUS 1
55  char *name;
56  int port_num;
58 };
59 
60 /* DMA_SIZE MUST be divisible by 188 and 128 !!! */
61 
62 #define INPUT_DMA_MAX_BUFS 32 /* hardware table limit */
63 #define INPUT_DMA_BUFS 8
64 #define INPUT_DMA_SIZE (128*47*21)
65 
66 #define OUTPUT_DMA_MAX_BUFS 32
67 #define OUTPUT_DMA_BUFS 8
68 #define OUTPUT_DMA_SIZE (128*47*21)
69 
70 struct ddb;
71 struct ddb_port;
72 
73 struct ddb_input {
74  struct ddb_port *port;
76  int attached;
77 
82 
86  int running;
90 
91  struct dvb_adapter adap;
92  struct dvb_device *dev;
93  struct dvb_frontend *fe;
94  struct dvb_frontend *fe2;
95  struct dmxdev dmxdev;
96  struct dvb_demux demux;
97  struct dvb_net dvbnet;
100  int users;
101  int (*gate_ctrl)(struct dvb_frontend *, int);
102 };
103 
104 struct ddb_output {
105  struct ddb_port *port;
114  int running;
118 
120  struct dvb_device *dev;
121 };
122 
123 struct ddb_i2c {
124  struct ddb *dev;
131  int done;
133 };
134 
135 struct ddb_port {
136  struct ddb *dev;
138  struct ddb_i2c *i2c;
140  u32 class;
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
151 
152  struct ddb_input *input[2];
155 };
156 
157 struct ddb {
158  struct pci_dev *pdev;
159  unsigned char *regs;
164 
165  struct device *ddb_dev;
166  int nr;
167  u8 iobuf[1028];
168 
169  struct ddb_info *info;
170  int msi;
171 };
172 
173 /****************************************************************************/
174 
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))
182 
183 /****************************************************************************/
184 
185 #endif