/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/base.h

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 18:37:30 UTC
  • Revision ID: csa@suren.me-20160302183730-nlrgi7h3yuizcizc
Restructure driver headers

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _PCIDRIVER_BASE_H
2
2
#define _PCIDRIVER_BASE_H
3
3
 
 
4
#include "config.h"
 
5
#include "compat.h"
 
6
#include "debug.h"
 
7
#include "pcibus.h"
4
8
#include "sysfs.h"
5
 
 
6
 
/**
7
 
 *
8
 
 * This file contains prototypes and data structures for internal use of the pciDriver.
9
 
 *
10
 
 *
11
 
 */
12
 
 
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);
18
 
 
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);
25
 
 
26
 
 
27
 
 
28
 
/* prototypes for module operations */
29
 
static int __init pcidriver_init(void);
30
 
static void pcidriver_exit(void);
31
 
 
32
 
/*
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:
35
 
 *
36
 
 *   echo "vendor device" > /sys/bus/pci/drivers/pciDriver/new_id
37
 
 * where vendor and device are in hex, without leading '0x'.
38
 
 *
39
 
 * The IDs themselves can be found in common.h
40
 
 *
41
 
 * For more info, see <kernel-source>/Documentation/pci.txt
42
 
 *
43
 
 * __devinitdata is applied because the kernel does not need those
44
 
 * tables any more after boot is finished on systems which don't
45
 
 * support hotplug.
46
 
 *
47
 
 */
48
 
 
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
53
 
    {0,0,0,0},
54
 
};
55
 
 
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 );
60
 
 
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 );
63
 
 
64
 
/*************************************************************************/
65
 
/* Static data */
66
 
/* Hold the allocated major & minor numbers */
67
 
static dev_t pcidriver_devt;
68
 
 
69
 
/* Number of devices allocated */
70
 
static atomic_t pcidriver_deviceCount;
71
 
 
72
 
/* Private data for probed devices */
73
 
static pcidriver_privdata_t* pcidriver_privdata[MAXDEVICES];
74
 
 
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);
84
 
 
85
 
#ifdef ENABLE_IRQ
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);
88
 
#endif
89
 
 
90
 
#endif
 
9
#include "dev.h"
 
10
#include "int.h"
 
11
 
 
12
pcidriver_privdata_t *pcidriver_get_privdata(int devid);
 
13
void pcidriver_put_privdata(pcidriver_privdata_t *privdata);
 
14
 
 
15
#endif /* _PCIDRIVER_BASE_H */