diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2009-12-02 19:57:10 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-01-17 08:55:27 -0500 |
commit | 41e840b13e111ba18b138d055ddd250bd5ad5e39 (patch) | |
tree | dd5c1a60f06549925277c396a964724dd87329e1 /drivers/media/dvb/mantis/mantis_common.h | |
parent | 6ccf80eb15ccaca4d3f1ab5162b9ded5eecd9971 (diff) |
V4L/DVB (13699): [Mantis, MB86A16] Initial checkin: Mantis, MB86A16
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_common.h')
-rw-r--r-- | drivers/media/dvb/mantis/mantis_common.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h new file mode 100644 index 000000000000..ba360f884967 --- /dev/null +++ b/drivers/media/dvb/mantis/mantis_common.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | Mantis PCI bridge driver | ||
3 | |||
4 | Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com) | ||
5 | |||
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. | ||
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 | 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. | ||
19 | */ | ||
20 | |||
21 | #ifndef __MANTIS_COMMON_H | ||
22 | #define __MANTIS_COMMON_H | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | #include <linux/moduleparam.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/pci.h> | ||
28 | |||
29 | #include "dvbdev.h" | ||
30 | #include "dvb_demux.h" | ||
31 | #include "dmxdev.h" | ||
32 | #include "dvb_frontend.h" | ||
33 | #include "dvb_net.h" | ||
34 | #include <linux/i2c.h> | ||
35 | #include "mantis_reg.h" | ||
36 | |||
37 | #define MANTIS_ERROR 0 | ||
38 | #define MANTIS_NOTICE 1 | ||
39 | #define MANTIS_INFO 2 | ||
40 | #define MANTIS_DEBUG 3 | ||
41 | |||
42 | #define dprintk(x, y, z, format, arg...) do { \ | ||
43 | if (z) { \ | ||
44 | if ((x > MANTIS_ERROR) && (x > y)) \ | ||
45 | printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | ||
46 | else if ((x > MANTIS_NOTICE) && (x > y)) \ | ||
47 | printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | ||
48 | else if ((x > MANTIS_INFO) && (x > y)) \ | ||
49 | printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | ||
50 | else if ((x > MANTIS_DEBUG) && (x > y)) \ | ||
51 | printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | ||
52 | } else { \ | ||
53 | if (x > y) \ | ||
54 | printk(format , ##arg); \ | ||
55 | } \ | ||
56 | } while(0) | ||
57 | |||
58 | #define mwrite(dat, addr) writel((dat), addr) | ||
59 | #define mread(addr) readl(addr) | ||
60 | |||
61 | #define mmwrite(dat, addr) mwrite((dat), (mantis->mantis_mmio + (addr))) | ||
62 | #define mmread(addr) mread(mantis->mantis_mmio + (addr)) | ||
63 | #define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr) | ||
64 | #define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr) | ||
65 | #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) | ||
66 | |||
67 | |||
68 | struct mantis_pci { | ||
69 | /* PCI stuff */ | ||
70 | u16 vendor_id; | ||
71 | u16 device_id; | ||
72 | u8 latency; | ||
73 | |||
74 | struct pci_dev *pdev; | ||
75 | |||
76 | unsigned long mantis_addr; | ||
77 | volatile void __iomem *mantis_mmio; | ||
78 | |||
79 | u8 irq; | ||
80 | u8 revision; | ||
81 | |||
82 | unsigned int num; | ||
83 | u16 ts_size; | ||
84 | |||
85 | /* RISC Core */ | ||
86 | u32 finished_block; | ||
87 | u32 last_block; | ||
88 | u32 line_bytes; | ||
89 | u32 line_count; | ||
90 | u32 risc_pos; | ||
91 | u8 *buf_cpu; | ||
92 | dma_addr_t buf_dma; | ||
93 | u32 *risc_cpu; | ||
94 | dma_addr_t risc_dma; | ||
95 | |||
96 | struct tasklet_struct tasklet; | ||
97 | |||
98 | struct i2c_adapter adapter; | ||
99 | int i2c_rc; | ||
100 | wait_queue_head_t i2c_wq; | ||
101 | |||
102 | /* DVB stuff */ | ||
103 | struct dvb_adapter dvb_adapter; | ||
104 | struct dvb_frontend *fe; | ||
105 | struct dvb_demux demux; | ||
106 | struct dmxdev dmxdev; | ||
107 | struct dmx_frontend fe_hw; | ||
108 | struct dmx_frontend fe_mem; | ||
109 | struct dvb_net dvbnet; | ||
110 | |||
111 | u8 feeds; | ||
112 | |||
113 | struct mantis_config *config; | ||
114 | |||
115 | u32 mantis_int_stat; | ||
116 | u32 mantis_int_mask; | ||
117 | |||
118 | /* board specific */ | ||
119 | u8 mac_address[8]; | ||
120 | u32 sub_vendor_id; | ||
121 | u32 sub_device_id; | ||
122 | |||
123 | /* A12 A13 A14 */ | ||
124 | int gpio_status;}; | ||
125 | |||
126 | extern unsigned int verbose; | ||
127 | extern unsigned int devs; | ||
128 | extern unsigned int i2c; | ||
129 | extern int mantis_dvb_init(struct mantis_pci *mantis); | ||
130 | extern int mantis_frontend_init(struct mantis_pci *mantis); | ||
131 | extern int mantis_dvb_exit(struct mantis_pci *mantis); | ||
132 | extern void mantis_dma_xfer(unsigned long data); | ||
133 | extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value); | ||
134 | |||
135 | #endif //__MANTIS_COMMON_H | ||