/* Mantis PCI bridge driver Copyright (C) 2005 Manu Abraham (manu@kromtek.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MANTIS_COMMON_H_ #define _MANTIS_COMMON_H_ #include #include #include #include #include "dvbdev.h" #include "dvb_demux.h" #include "dmxdev.h" #include "dvb_frontend.h" #include "dvb_net.h" #include #include "mantis_reg.h" #define MANTIS_ERROR 0 #define MANTIS_NOTICE 1 #define MANTIS_INFO 2 #define MANTIS_DEBUG 3 #define dprintk(x, y, z, format, arg...) do { \ if (z) { \ if ((x > MANTIS_ERROR) && (x > y)) \ printk(KERN_ERR "%s: " format "\n" , __FUNCTION__ , ##arg); \ else if ((x > MANTIS_NOTICE) && (x > y)) \ printk(KERN_NOTICE "%s: " format "\n" , __FUNCTION__ , ##arg); \ else if ((x > MANTIS_INFO) && (x > y)) \ printk(KERN_INFO "%s: " format "\n" , __FUNCTION__ , ##arg); \ else if ((x > MANTIS_DEBUG) && (x > y)) \ printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ##arg); \ } else { \ if (x > y) \ printk(format , ##arg); \ } \ } while(0) #define mwrite(dat, addr) writel((dat), addr) #define mread(addr) readl(addr) #define mmwrite(dat, addr) mwrite((dat), (mantis->mantis_mmio + (addr))) #define mmread(addr) mread(mantis->mantis_mmio + (addr)) #define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr) #define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr) #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) struct mantis_pci { /* PCI stuff */ __u16 vendor_id; __u16 device_id; __u8 latency; unsigned long mantis_addr; volatile void __iomem *mantis_mmio; __u8 irq; __u8 revision; __u16 mantis_card_num; __u16 ts_size; /* RISC Core */ volatile __u32 finished_block; volatile __u32 last_block; __u32 block_count; __u32 block_bytes; __u32 line_bytes; __u32 line_count; __u32 risc_pos; __u32 buf_size; __u8 *buf_cpu; dma_addr_t buf_dma; __u32 risc_size; __u32 *risc_cpu; dma_addr_t risc_dma; struct tasklet_struct tasklet; struct i2c_adapter adapter; int i2c_rc; /* DVB stuff */ struct dvb_adapter dvb_adapter; struct dvb_frontend *fe; struct dvb_demux demux; struct dmxdev dmxdev; struct dmx_frontend fe_hw; struct dmx_frontend fe_mem; struct dvb_net dvbnet; __u8 feeds; struct mantis_config *config; __u32 mantis_int_stat; __u32 mantis_int_mask; /* board specific */ __u8 mac_address[8]; __u32 sub_vendor_id; __u32 sub_device_id; }; extern unsigned int verbose; extern int mantis_dvb_init(struct mantis_pci *mantis); extern int mantis_frontend_init(struct mantis_pci *mantis); extern int mantis_dvb_exit(struct mantis_pci *mantis); extern void mantis_dma_xfer(unsigned long data); #endif