/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/dev.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
#ifndef _PCIDRIVER_DEV_H
 
2
#define _PCIDRIVER_DEV_H
 
3
 
 
4
typedef struct pcidriver_privdata_s pcidriver_privdata_t;
 
5
 
 
6
#include "kmem.h"
 
7
#include "umem.h"
 
8
 
 
9
 
 
10
/* Hold the driver private data */
 
11
struct pcidriver_privdata_s {
 
12
    int devid;                                  /* the device id */
 
13
    dev_t devno;                                /* device number (major and minor) */
 
14
    struct pci_dev *pdev;                       /* PCI device */
 
15
    struct device *class_dev;                   /* Class device */
 
16
    struct cdev cdev;                           /* char device struct */
 
17
    int mmap_mode;                              /* current mmap mode */
 
18
    int mmap_area;                              /* current PCI mmap area */
 
19
 
 
20
#ifdef ENABLE_IRQ
 
21
    int irq_enabled;                            /* Non-zero if IRQ is enabled */
 
22
    int irq_count;                              /* Just an IRQ counter */
 
23
 
 
24
    wait_queue_head_t irq_queues[ PCIDRIVER_INT_MAXSOURCES ];       /* One queue per interrupt source */
 
25
    atomic_t irq_outstanding[ PCIDRIVER_INT_MAXSOURCES ];           /* Outstanding interrupts per queue */
 
26
    volatile unsigned int *bars_kmapped[6];                         /* PCI BARs mmapped in kernel space */
 
27
#endif
 
28
 
 
29
    spinlock_t kmemlist_lock;                   /* Spinlock to lock kmem list operations */
 
30
    struct list_head kmem_list;                 /* List of 'kmem_list_entry's associated with this device */
 
31
    pcidriver_kmem_entry_t *kmem_last_sync;     /* Last accessed kmem entry */
 
32
    atomic_t kmem_count;                        /* id for next kmem entry */
 
33
 
 
34
    int kmem_cur_id;                            /* Currently selected kmem buffer, for mmap */
 
35
 
 
36
    spinlock_t umemlist_lock;                   /* Spinlock to lock umem list operations */
 
37
    struct list_head umem_list;                 /* List of 'umem_list_entry's associated with this device */
 
38
    atomic_t umem_count;                        /* id for next umem entry */
 
39
 
 
40
    int msi_mode;                               /* Flag specifying if interrupt have been initialized in MSI mode */
 
41
    atomic_t refs;                              /* Reference counter */
 
42
};
 
43
 
 
44
const struct file_operations *pcidriver_get_fops(void);
 
45
 
 
46
void pcidriver_module_get(pcidriver_privdata_t *privdata);
 
47
void pcidriver_module_put(pcidriver_privdata_t *privdata);
 
48
 
 
49
long pcidriver_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 
50
 
 
51
#endif /* _PCIDRIVER_DEV_H */
 
52