Rev 19 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
19 | f9daq | 1 | #ifndef __PCIVME_H__ |
2 | #define __PCIVME_H__ |
||
3 | //------------------------------------------------------------------------- |
||
4 | // WINNT driver for PCIVME interface from ARW Elektronik, Germany --------- |
||
5 | // IO definitions and common data structures between application and driver |
||
6 | // |
||
7 | // (c) 1999-2004 ARW Elektronik |
||
8 | // |
||
9 | // this source code is published under GPL (Open Source). You can use, redistrubute and |
||
10 | // modify it unless this header is not modified or deleted. No warranty is given that |
||
11 | // this software will work like expected. |
||
12 | // This product is not authorized for use as critical component in life support systems |
||
13 | // wihout the express written approval of ARW Elektronik Germany. |
||
14 | // |
||
15 | // Please announce changes and hints to ARW Elektronik |
||
16 | // |
||
17 | // $Log: pcivme.h,v $ |
||
18 | // Revision 1.3 2004/07/24 07:07:26 klaus |
||
19 | // Update copyright to 2004 |
||
20 | // |
||
21 | // Revision 1.2 2003/11/15 19:12:50 klaus |
||
22 | // Update copyright to 2003 |
||
23 | // |
||
24 | // Revision 1.1.1.1 2003/11/14 23:16:33 klaus |
||
25 | // First put into repository |
||
26 | // |
||
27 | // Revision 1.4 2002/10/27 17:02:30 klaus |
||
28 | // File addressing bug > 2 Gbtye circumvent |
||
29 | // |
||
30 | // Revision 1.3 2002/10/27 16:17:48 klaus |
||
31 | // Typing bug fixed caused at log addition |
||
32 | // |
||
33 | // Revision 1.2 2002/10/27 16:11:02 klaus |
||
34 | // Added CVS log into header |
||
35 | // |
||
36 | // what who when |
||
37 | // started AR 15.06.99 |
||
38 | // |
||
39 | |||
40 | //------------------------------------------------------------------------- |
||
41 | // INCLUDES |
||
42 | // |
||
43 | // #include <devioctl.h> must be declared before inclusion when used for driver |
||
44 | // #include <winioctl.h> must be declared before inclusion when used for applications |
||
45 | |||
46 | //------------------------------------------------------------------------- |
||
47 | // DEFINES |
||
48 | // |
||
49 | |||
50 | // to get a compatible view to WIN95 driver |
||
51 | #define USER_CONTROL_CODE(x) (0x800 + x) |
||
52 | |||
53 | // initialise a dedicated VMEMM hardware |
||
54 | #define PCIVME_INIT_HARDWARE CTL_CODE(\ |
||
55 | FILE_DEVICE_UNKNOWN,\ |
||
56 | USER_CONTROL_CODE(0),\ |
||
57 | METHOD_BUFFERED,\ |
||
58 | FILE_ANY_ACCESS) |
||
59 | |||
60 | // de-initialise a dedicated VMEMM hardware |
||
61 | #define PCIVME_DEINIT_HARDWARE CTL_CODE(\ |
||
62 | FILE_DEVICE_UNKNOWN,\ |
||
63 | USER_CONTROL_CODE(1),\ |
||
64 | METHOD_BUFFERED,\ |
||
65 | FILE_ANY_ACCESS) |
||
66 | |||
67 | // get a static status info from a dedicted VMEMM+PCIADA hardware |
||
68 | #define PCIVME_GET_STATIC_STATUS CTL_CODE(\ |
||
69 | FILE_DEVICE_UNKNOWN,\ |
||
70 | USER_CONTROL_CODE(4),\ |
||
71 | METHOD_BUFFERED,\ |
||
72 | FILE_ANY_ACCESS) |
||
73 | |||
74 | // get dynamically changing status from PCIADA+VMEMM |
||
75 | #define PCIVME_GET_DYNAMIC_STATUS CTL_CODE(\ |
||
76 | FILE_DEVICE_UNKNOWN,\ |
||
77 | USER_CONTROL_CODE(5),\ |
||
78 | METHOD_BUFFERED,\ |
||
79 | FILE_ANY_ACCESS) |
||
80 | |||
81 | // read a vector in case of interrupt from VMEMM or PCIADA |
||
82 | #define PCIVME_READ_VECTOR CTL_CODE(\ |
||
83 | FILE_DEVICE_UNKNOWN,\ |
||
84 | USER_CONTROL_CODE(6),\ |
||
85 | METHOD_BUFFERED,\ |
||
86 | FILE_ANY_ACCESS) |
||
87 | |||
88 | // access VIC68A registers direct |
||
89 | #define PCIVME_ACCESS_VIC68A CTL_CODE(\ |
||
90 | FILE_DEVICE_UNKNOWN,\ |
||
91 | USER_CONTROL_CODE(7),\ |
||
92 | METHOD_BUFFERED,\ |
||
93 | FILE_ANY_ACCESS) |
||
94 | |||
95 | // enable or disable interrupts from user space |
||
96 | #define PCIVME_CONTROL_INTERRUPTS CTL_CODE(\ |
||
97 | FILE_DEVICE_UNKNOWN,\ |
||
98 | USER_CONTROL_CODE(9),\ |
||
99 | METHOD_BUFFERED,\ |
||
100 | FILE_ANY_ACCESS) |
||
101 | |||
102 | // generate a (undivisible) test-and-set instruction |
||
103 | #define PCIVME_TAS CTL_CODE(\ |
||
104 | FILE_DEVICE_UNKNOWN,\ |
||
105 | USER_CONTROL_CODE(10),\ |
||
106 | METHOD_BUFFERED,\ |
||
107 | FILE_ANY_ACCESS) |
||
108 | |||
109 | // generate a reset on VME BUS for a dedicated VMEMM interface |
||
110 | #define PCIVME_RESET CTL_CODE(\ |
||
111 | FILE_DEVICE_UNKNOWN,\ |
||
112 | USER_CONTROL_CODE(12),\ |
||
113 | METHOD_BUFFERED,\ |
||
114 | FILE_ANY_ACCESS) |
||
115 | |||
116 | // set the access parameter for this file (vmemm) |
||
117 | #define PCIVME_SET_ACCESS_PARA CTL_CODE(\ |
||
118 | FILE_DEVICE_UNKNOWN,\ |
||
119 | USER_CONTROL_CODE(13),\ |
||
120 | METHOD_BUFFERED,\ |
||
121 | FILE_ANY_ACCESS) |
||
122 | |||
123 | // my last usefull control code - change each time you add a ctl_code |
||
124 | #define PCIVME_LAST_CTL_CODE PCIVME_SET_ACCESS_PARA |
||
125 | |||
126 | // to make standard entries for not compatible WIN95 call codes |
||
127 | #define PCIVME_INCOMPATIBLE CTL_CODE(\ |
||
128 | FILE_DEVICE_UNKNOWN,\ |
||
129 | USER_CONTROL_CODE(255),\ |
||
130 | METHOD_BUFFERED,\ |
||
131 | FILE_ANY_ACCESS) |
||
132 | |||
133 | // to get a compatible view to WIN95 driver |
||
134 | #define VPCIVMED_INIT_HARDWARE PCIVME_INIT_HARDWARE |
||
135 | #define VPCIVMED_DEINIT_HARDWARE PCIVME_DEINIT_HARDWARE |
||
136 | #define VPCIVMED_ATTACH_WINDOW PCIVME_INCOMPATIBLE // no compatibility! |
||
137 | #define VPCIVMED_DETACH_WINDOW PCIVME_INCOMPATIBLE // no compatibility! |
||
138 | #define VPCIVMED_GET_STATIC_STATUS PCIVME_GET_STATIC_STATUS |
||
139 | #define VPCIVMED_GET_DYNAMIC_STATUS PCIVME_GET_DYNAMIC_STATUS |
||
140 | #define VPCIVMED_READ_VECTOR PCIVME_READ_VECTOR |
||
141 | #define VPCIVMED_ACCESS_VIC68A PCIVME_ACCESS_VIC68A |
||
142 | #define VPCIVMED_CONTROL_INTERRUPTS PCIVME_CONTROL_INTERRUPTS |
||
143 | #define VPCIVMED_TAS PCIVME_TAS |
||
144 | #define VPCIVMED_GET_PCIADA_STATUS PCIVME_GET_PCIADA_STATUS |
||
145 | #define VPCIVMED_RESET PCIVME_RESET |
||
146 | |||
147 | // switches for PCIVME_(DE)INIT_HARDWARE ------------------------ |
||
148 | #define LCR (UCHAR)0 // destination is LCR register |
||
149 | #define IFR (UCHAR)1 // destination is VME-Interface register |
||
150 | #define VIC (UCHAR)2 // destination is VIC68A register |
||
151 | #define STOP (UCHAR)255 // this command stops the init machine |
||
152 | |||
153 | #define BYTE_ACCESS (UCHAR)1 // write byte wise |
||
154 | #define WORD_ACCESS (UCHAR)2 // word |
||
155 | #define LONG_ACCESS (UCHAR)4 // long |
||
156 | |||
157 | // switches for PCIVME_ACCESS_VIC68A -------------------------- |
||
158 | #define VIC68A_READ 0 // read only access |
||
159 | #define VIC68A_WRITE 1 // write and read back access |
||
160 | #define VIC68A_OR 2 // read, bitwise 'or' content and read back access |
||
161 | #define VIC68A_AND 3 // read, bitwise 'and' content and read back access |
||
162 | #define VIC68A_WRITE_ONLY 4 // do not read back after write |
||
163 | |||
164 | // switches for the PCIVME_RESET ------------------------------ |
||
165 | #define VME_RESET_CMD 0 // raise a VME reset only |
||
166 | #define LOCAL_RESET_CMD 1 // raise a local reset only |
||
167 | #define GLOBAL_RESET_CMD 2 // raise a global reset |
||
168 | #define POLL_RESET_CMD 3 // ask if reset is finished |
||
169 | |||
170 | #define BOGUSADDRESS 0xFFFFFFFF // compatibilty to WIN95 |
||
171 | |||
172 | #ifndef PHYSICAL_ADDRESS |
||
173 | #define PHYSICAL_ADDRESS LARGE_INTEGER |
||
174 | #endif |
||
175 | |||
176 | //------------------------------------------------------------------------- |
||
177 | // TYPEDEFS |
||
178 | // |
||
179 | typedef struct // one command element to initialize interface or deinitialize |
||
180 | { |
||
181 | UCHAR range; // 0 = lcr, 1 = vme-interface, -1 = stop, default = vme-if |
||
182 | UCHAR type; // 1 = byte access, 2 = word access, 4 = dword access, default byte |
||
183 | USHORT offset; // offset into interface address range for initialisation |
||
184 | ULONG value; // value to initialize |
||
185 | } PCIVME_INIT_ELEMENT; |
||
186 | |||
187 | typedef struct |
||
188 | { |
||
189 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
190 | PCIVME_INIT_ELEMENT sVie[8]; // at least one zero element must be the last |
||
191 | } PCIVME_INIT_COMMAND; |
||
192 | |||
193 | typedef struct |
||
194 | { |
||
195 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
196 | UCHAR bAddressModifier; // set the current modifier |
||
197 | UCHAR bAccessType; // set the current access type (1,2,4) |
||
198 | UCHAR bIncrement; // set the current byte increment count |
||
199 | ULONG dwAccessBase; // base address of seek operation (extended modifiers only, else must = 0) |
||
200 | } PCIVME_ACCESS_COMMAND; |
||
201 | |||
202 | |||
203 | typedef struct |
||
204 | { |
||
205 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
206 | USHORT wRegisterAddress; // address offset of vic68a register |
||
207 | USHORT wAccessMode; // read, write, or, and |
||
208 | UCHAR bContent; // content to write, and, or |
||
209 | } PCIVME_VIC68A_ACTION; |
||
210 | |||
211 | // includes static information about driver parameters ------ |
||
212 | typedef struct |
||
213 | { |
||
214 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
215 | ULONG dwLinkCount; // how often this interface is requested |
||
216 | |||
217 | USHORT wNumMemWindows; // aus der aktuellen konfiguration |
||
218 | USHORT wNumIOPorts; |
||
219 | USHORT wNumIRQs; |
||
220 | USHORT wNumDMAs; |
||
221 | |||
222 | USHORT wModuleType; // von der angeschlossenen hardware gelesen |
||
223 | USHORT wFPGAVersion; |
||
224 | USHORT wModuleNumber; |
||
225 | USHORT wWordMode; |
||
226 | |||
227 | USHORT wSysControl; // if the associated VMEMM has slot 1 function |
||
228 | USHORT wConnected; // is the VMEMM connected (obsolete sometimes) |
||
229 | |||
230 | PHYSICAL_ADDRESS pvLcr; // physikalische adresse des lcr |
||
231 | PHYSICAL_ADDRESS pvIfr; // physikalische adresse des interfaces ohne vme |
||
232 | |||
233 | ULONG dwDriverVersion; // highWord.lowWord |
||
234 | ULONG dwDriverVariant; // show customized variants here |
||
235 | } PCIVME_STATIC_STATUS; |
||
236 | |||
237 | typedef struct |
||
238 | { |
||
239 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
240 | |||
241 | USHORT wVMEMM_connected; // status: VMEMM is connected and powered |
||
242 | USHORT wVMEMM_enable; // status: VMEMM access is enabled |
||
243 | USHORT wPCIADAIrq; // status: PCIADA timeout IRQ pending |
||
244 | USHORT wVMEMMIrq; // status: VMEMM IRQ pending |
||
245 | } PCIVME_DYNAMIC_STATUS; |
||
246 | |||
247 | typedef struct |
||
248 | { |
||
249 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
250 | ULONG dwAddress; // tas to address |
||
251 | USHORT wModifier; // VME address modifier for this window |
||
252 | UCHAR bContent; // byte content to store and get back |
||
253 | } PCIVME_TAS_STRUCT; |
||
254 | |||
255 | typedef struct |
||
256 | { |
||
257 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
258 | USHORT wCommand; // the appropriate reset command |
||
259 | } PCIVME_RESET_COMMAND; |
||
260 | |||
261 | typedef struct |
||
262 | { |
||
263 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95 |
||
264 | USHORT wResult; |
||
265 | } PCIVME_RESET_RESULT; // polling result: in progress if (wResult != 0) |
||
266 | |||
267 | typedef struct |
||
268 | { |
||
269 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95.. |
||
270 | USHORT wEnable; // a 1 enables the queue filling, a 0 disables |
||
271 | } PCIVME_IRQ_CONTROL; |
||
272 | |||
273 | typedef struct // to request vectors from a interface |
||
274 | { |
||
275 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95.. |
||
276 | USHORT wRequestCount; // maximum number of vectors to requests |
||
277 | BOOLEAN bPoll; // no blocking allowed - poll always |
||
278 | } PCIVME_VECTOR_REQUEST; |
||
279 | |||
280 | typedef struct // the response to the above request |
||
281 | { |
||
282 | ULONG dwInterface; // here dummy 'cause of compatibility to WIN95.. |
||
283 | USHORT wPendingCount; // represents the number of vectors pending |
||
284 | USHORT wCount; // actual delivered count of vectors |
||
285 | BOOLEAN bOverflow; // there was a irq overflow @ this channel |
||
286 | UCHAR bStatusID; // base of following vector array |
||
287 | } PCIVME_VECTOR_RESPONSE; |
||
288 | |||
289 | #endif // __PCIVME_H__ |