1
1
#ifndef _PCIDRIVER_BASE_H
2
2
#define _PCIDRIVER_BASE_H
8
* This file contains prototypes and data structures for internal use of the pciDriver.
13
/* prototypes for file_operations */
14
static struct file_operations pcidriver_fops;
15
int pcidriver_mmap( struct file *filp, struct vm_area_struct *vmap );
16
int pcidriver_open(struct inode *inode, struct file *filp );
17
int pcidriver_release(struct inode *inode, struct file *filp);
19
/* prototypes for device operations */
20
#ifndef PCIDRIVER_DUMMY_DEVICE
21
static struct pci_driver pcidriver_driver;
22
#endif /* ! PCIDRIVER_DUMMY_DEVICE */
23
static int __devinit pcidriver_probe(struct pci_dev *pdev, const struct pci_device_id *id);
24
static void __devexit pcidriver_remove(struct pci_dev *pdev);
28
/* prototypes for module operations */
29
static int __init pcidriver_init(void);
30
static void pcidriver_exit(void);
33
* This is the table of PCI devices handled by this driver by default
34
* If you want to add devices dynamically to this list, do:
36
* echo "vendor device" > /sys/bus/pci/drivers/pciDriver/new_id
37
* where vendor and device are in hex, without leading '0x'.
39
* The IDs themselves can be found in common.h
41
* For more info, see <kernel-source>/Documentation/pci.txt
43
* __devinitdata is applied because the kernel does not need those
44
* tables any more after boot is finished on systems which don't
49
static const __devinitdata struct pci_device_id pcidriver_ids[] = {
50
{ PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_ML605_DEVICE_ID ) }, // PCI-E Xilinx ML605
51
{ PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_IPECAMERA_DEVICE_ID ) }, // PCI-E IPE Camera
52
{ PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_KAPTURE_DEVICE_ID ) }, // PCI-E KAPTURE board for HEB
56
/* prototypes for internal driver functions */
57
int pcidriver_pci_read( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
58
int pcidriver_pci_write( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
59
int pcidriver_pci_info( pcidriver_privdata_t *privdata, pcilib_board_info_t *pci_info );
61
int pcidriver_mmap_pci( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap , int bar );
62
int pcidriver_mmap_kmem( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap );
64
/*************************************************************************/
66
/* Hold the allocated major & minor numbers */
67
static dev_t pcidriver_devt;
69
/* Number of devices allocated */
70
static atomic_t pcidriver_deviceCount;
72
/* Private data for probed devices */
73
static pcidriver_privdata_t* pcidriver_privdata[MAXDEVICES];
75
/* Sysfs attributes */
76
static DEVICE_ATTR(mmap_mode, 0664, pcidriver_show_mmap_mode, pcidriver_store_mmap_mode);
77
static DEVICE_ATTR(mmap_area, 0664, pcidriver_show_mmap_area, pcidriver_store_mmap_area);
78
static DEVICE_ATTR(kmem_count, S_IRUGO, pcidriver_show_kmem_count, NULL);
79
static DEVICE_ATTR(kbuffers, S_IRUGO, pcidriver_show_kbuffers, NULL);
80
static DEVICE_ATTR(kmem_alloc, 0220, NULL, pcidriver_store_kmem_alloc);
81
static DEVICE_ATTR(kmem_free, 0220, NULL, pcidriver_store_kmem_free);
82
static DEVICE_ATTR(umappings, S_IRUGO, pcidriver_show_umappings, NULL);
83
static DEVICE_ATTR(umem_unmap, 0220, NULL, pcidriver_store_umem_unmap);
86
static DEVICE_ATTR(irq_count, S_IRUGO, pcidriver_show_irq_count, NULL);
87
static DEVICE_ATTR(irq_queues, S_IRUGO, pcidriver_show_irq_queues, NULL);
12
pcidriver_privdata_t *pcidriver_get_privdata(int devid);
13
void pcidriver_put_privdata(pcidriver_privdata_t *privdata);
15
#endif /* _PCIDRIVER_BASE_H */