/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/pciDriver.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-20 20:01:04 UTC
  • Revision ID: csa@suren.me-20150420200104-b5xny65io8lvoz3w
Big redign of model structures

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 */
58
58
 
59
59
#include <linux/ioctl.h>
60
 
#include "../pcilib_types.h"
61
60
 
62
61
/* Identifies the PCI-E Xilinx ML605 */
63
62
#define PCIE_XILINX_VENDOR_ID 0x10ee
64
63
#define PCIE_ML605_DEVICE_ID 0x6024
65
64
 
66
 
/* Identifies the PCI-E IPE Camera */
 
65
/* Identifies the PCI-E IPE Hardware */
67
66
#define PCIE_IPECAMERA_DEVICE_ID 0x6081
68
67
#define PCIE_KAPTURE_DEVICE_ID 0x6028
69
 
//#define PCIE_IPECAMERA_DEVICE_ID 0x6018
70
68
 
71
69
 
72
70
/* Possible values for ioctl commands */
73
71
 
74
72
/* PCI mmap areas */
75
 
#define PCIDRIVER_BAR0          0
76
 
#define PCIDRIVER_BAR1          1
77
 
#define PCIDRIVER_BAR2          2
78
 
#define PCIDRIVER_BAR3          3
79
 
#define PCIDRIVER_BAR4          4
80
 
#define PCIDRIVER_BAR5          5
 
73
#define PCIDRIVER_BAR0                  0
 
74
#define PCIDRIVER_BAR1                  1
 
75
#define PCIDRIVER_BAR2                  2
 
76
#define PCIDRIVER_BAR3                  3
 
77
#define PCIDRIVER_BAR4                  4
 
78
#define PCIDRIVER_BAR5                  5
81
79
 
82
80
/* mmap mode of the device */
83
 
#define PCIDRIVER_MMAP_PCI      0
84
 
#define PCIDRIVER_MMAP_KMEM 1
 
81
#define PCIDRIVER_MMAP_PCI              0
 
82
#define PCIDRIVER_MMAP_KMEM             1
85
83
 
86
84
/* Direction of a DMA operation */
87
85
#define PCIDRIVER_DMA_BIDIRECTIONAL     0
88
 
#define PCIDRIVER_DMA_TODEVICE          PCILIB_KMEM_SYNC_TODEVICE
89
 
#define PCIDRIVER_DMA_FROMDEVICE        PCILIB_KMEM_SYNC_FROMDEVICE
 
86
#define PCIDRIVER_DMA_TODEVICE          1//PCILIB_KMEM_SYNC_TODEVICE
 
87
#define PCIDRIVER_DMA_FROMDEVICE        2//PCILIB_KMEM_SYNC_FROMDEVICE
90
88
 
91
89
/* Possible sizes in a PCI command */
92
 
#define PCIDRIVER_PCI_CFG_SZ_BYTE  1
93
 
#define PCIDRIVER_PCI_CFG_SZ_WORD  2
94
 
#define PCIDRIVER_PCI_CFG_SZ_DWORD 3
 
90
#define PCIDRIVER_PCI_CFG_SZ_BYTE       1
 
91
#define PCIDRIVER_PCI_CFG_SZ_WORD       2
 
92
#define PCIDRIVER_PCI_CFG_SZ_DWORD      3
95
93
 
96
94
/* Possible types of SG lists */
97
 
#define PCIDRIVER_SG_NONMERGED 0
98
 
#define PCIDRIVER_SG_MERGED 1
 
95
#define PCIDRIVER_SG_NONMERGED          0
 
96
#define PCIDRIVER_SG_MERGED             1
99
97
 
100
98
/* Maximum number of interrupt sources */
101
 
#define PCIDRIVER_INT_MAXSOURCES 16
102
 
 
103
 
 
104
 
#define KMEM_FLAG_REUSE 1       /**< Try to reuse existing buffer with the same use & item */
105
 
#define KMEM_FLAG_EXCLUSIVE 2   /**< Allow only a single application accessing a specified use & item */
106
 
#define KMEM_FLAG_PERSISTENT 4  /**< Sets persistent mode */
107
 
#define KMEM_FLAG_HW 8          /**< The buffer may be accessed by hardware, the hardware access will not occur any more if passed to _free function */
108
 
#define KMEM_FLAG_FORCE 16      /**< Force memory cleanup even if references are present */
109
 
#define KMEM_FLAG_MASS 32       /**< Apply to all buffers of selected use */
110
 
#define KMEM_FLAG_TRY 64        /**< Do not allocate buffers, try to reuse and fail if not possible */
111
 
 
112
 
#define KMEM_FLAG_REUSED 1              /**< Indicates if buffer with specified use & item was already allocated and reused */
113
 
#define KMEM_FLAG_REUSED_PERSISTENT 4   /**< Indicates that reused buffer was persistent before the call */
114
 
#define KMEM_FLAG_REUSED_HW 8           /**< Indicates that reused buffer had a HW reference before the call */
115
 
 
 
99
#define PCIDRIVER_INT_MAXSOURCES        16
 
100
 
 
101
#define KMEM_REF_HW             0x80000000                              /**< Special reference to indicate hardware access */
 
102
#define KMEM_REF_COUNT          0x0FFFFFFF                              /**< Mask of reference counter (mmap/munmap), couting in mmaped memory pages */
 
103
 
 
104
#define KMEM_MODE_REUSABLE      0x80000000                              /**< Indicates reusable buffer */
 
105
#define KMEM_MODE_EXCLUSIVE     0x40000000                              /**< Only a single process is allowed to mmap the buffer */
 
106
#define KMEM_MODE_PERSISTENT    0x20000000                              /**< Persistent mode instructs kmem_free to preserve buffer in memory */
 
107
#define KMEM_MODE_COUNT         0x0FFFFFFF                              /**< Mask of reuse counter (alloc/free) */
 
108
 
 
109
#define KMEM_FLAG_REUSE                 PCILIB_KMEM_FLAG_REUSE          /**< Try to reuse existing buffer with the same use & item */
 
110
#define KMEM_FLAG_EXCLUSIVE             PCILIB_KMEM_FLAG_EXCLUSIVE      /**< Allow only a single application accessing a specified use & item */
 
111
#define KMEM_FLAG_PERSISTENT            PCILIB_KMEM_FLAG_PERSISTENT     /**< Sets persistent mode */
 
112
#define KMEM_FLAG_HW                    PCILIB_KMEM_FLAG_HARDWARE       /**< The buffer may be accessed by hardware, the hardware access will not occur any more if passed to _free function */
 
113
#define KMEM_FLAG_FORCE                 PCILIB_KMEM_FLAG_FORCE          /**< Force memory cleanup even if references are present */
 
114
#define KMEM_FLAG_MASS                  PCILIB_KMEM_FLAG_MASS           /**< Apply to all buffers of selected use */
 
115
#define KMEM_FLAG_TRY                   PCILIB_KMEM_FLAG_TRY            /**< Do not allocate buffers, try to reuse and fail if not possible */
 
116
 
 
117
#define KMEM_FLAG_REUSED                PCILIB_KMEM_FLAG_REUSE          /**< Indicates if buffer with specified use & item was already allocated and reused */
 
118
#define KMEM_FLAG_REUSED_PERSISTENT     PCILIB_KMEM_FLAG_PERSISTENT     /**< Indicates that reused buffer was persistent before the call */
 
119
#define KMEM_FLAG_REUSED_HW             PCILIB_KMEM_FLAG_HARDWARE       /**< Indicates that reused buffer had a HW reference before the call */
116
120
 
117
121
/* Types */
118
122
typedef struct {
 
123
    unsigned short vendor_id;
 
124
    unsigned short device_id;
 
125
    unsigned short bus;
 
126
    unsigned short slot;
 
127
    unsigned short func;
 
128
    unsigned short devfn;
 
129
    unsigned char interrupt_pin;
 
130
    unsigned char interrupt_line;
 
131
    unsigned int irq;
 
132
    unsigned long bar_start[6];
 
133
    unsigned long bar_length[6];
 
134
    unsigned long bar_flags[6];
 
135
} pcilib_board_info_t;
 
136
 
 
137
typedef struct {
119
138
        unsigned long type;
120
139
        unsigned long pa;
121
140
        unsigned long size;
166
185
        } val;
167
186
} pci_cfg_cmd;
168
187
 
169
 
typedef struct {
170
 
        unsigned short vendor_id;
171
 
        unsigned short device_id;
172
 
        unsigned short bus;
173
 
        unsigned short slot;
174
 
        unsigned short func;
175
 
        unsigned short devfn;
176
 
        unsigned char interrupt_pin;
177
 
        unsigned char interrupt_line;
178
 
        unsigned int irq;
179
 
        unsigned long bar_start[6];
180
 
        unsigned long bar_length[6];
181
 
        unsigned long bar_flags[6];
182
 
} pcilib_board_info_t;
183
 
 
184
 
 
185
188
/* ioctl interface */
186
189
/* See documentation for a detailed usage explanation */
187
190