2 Mantis PCI bridge driver
4 Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __MANTIS_COMMON_H
22 #define __MANTIS_COMMON_H
24 #include <linux/module.h>
25 #include <linux/moduleparam.h>
26 #include <linux/kernel.h>
27 #include <linux/pci.h>
28 #include <linux/mutex.h>
31 #include "dvb_demux.h"
33 #include "dvb_frontend.h"
35 #include <linux/i2c.h>
36 #include "mantis_reg.h"
38 #include "mantis_link.h"
40 #define MANTIS_ERROR 0
41 #define MANTIS_NOTICE 1
43 #define MANTIS_DEBUG 3
45 #define dprintk(x, y, z, format, arg...) do { \
47 if ((x > MANTIS_ERROR) && (x > y)) \
48 printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
49 else if ((x > MANTIS_NOTICE) && (x > y)) \
50 printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
51 else if ((x > MANTIS_INFO) && (x > y)) \
52 printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
53 else if ((x > MANTIS_DEBUG) && (x > y)) \
54 printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
57 printk(format , ##arg); \
61 #define mwrite(dat, addr) writel((dat), addr)
62 #define mread(addr) readl(addr)
64 #define mmwrite(dat, addr) mwrite((dat), (mantis->mantis_mmio + (addr)))
65 #define mmread(addr) mread(mantis->mantis_mmio + (addr))
66 #define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr)
67 #define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr)
68 #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
70 #define MANTIS_TS_188 0
71 #define MANTIS_TS_204 1
73 struct mantis_hwconfig {
90 unsigned long mantis_addr;
91 volatile void __iomem *mantis_mmio;
109 struct tasklet_struct tasklet;
111 struct i2c_adapter adapter;
113 wait_queue_head_t i2c_wq;
114 struct mutex i2c_lock;
117 struct dvb_adapter dvb_adapter;
118 struct dvb_frontend *fe;
119 struct dvb_demux demux;
120 struct dmxdev dmxdev;
121 struct dmx_frontend fe_hw;
122 struct dmx_frontend fe_mem;
123 struct dvb_net dvbnet;
127 struct mantis_hwconfig *hwconfig;
140 struct mantis_ca *mantis_ca;
143 extern unsigned int verbose;
144 extern unsigned int devs;
145 extern unsigned int i2c;
146 extern int mantis_dvb_init(struct mantis_pci *mantis);
147 extern int mantis_frontend_init(struct mantis_pci *mantis);
148 extern int mantis_dvb_exit(struct mantis_pci *mantis);
149 extern void mantis_dma_xfer(unsigned long data);
150 extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
152 #endif //__MANTIS_COMMON_H