OpenCBM
cbmioctl.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version
15  * 2 of the License, or (at your option) any later version.
16  *
17  * Copyright 1999 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
18  * Copyright 2001-2006,2008-2009 Spiro Trikaliotis
19  * Copyright 2009 Arnd <arnd(at)jonnz(dot)de>
20 */
21 
22 #ifndef CBM_IOCTL_H
23 #define CBM_IOCTL_H
24 
26 typedef
27 enum iec_cabletype
28 {
29  IEC_CABLETYPE_UNSPEC = -2, /*< don't use! */
30  IEC_CABLETYPE_AUTO = -1, IEC_CABLETYPE_XM = 0, IEC_CABLETYPE_XA = 1,
31  IEC_CABLETYPE_XE
33 
34 
35 
38 #define CBM_REGKEY_SERVICE "System\\CurrentControlSet\\Services\\opencbm"
39 
42 #define CBM_REGKEY_SERVICE_DEFAULTLPT "DefaultLpt"
43 
46 #define CBM_REGKEY_SERVICE_IECCABLE "CableType"
47 
50 #define CBM_REGKEY_SERVICE_PERMLOCK "PermanentlyLock"
51 
53 #define CBM_REGKEY_SERVICE_DEBUGFLAGS "DebugFlags"
54 
56 #define CBM_REGKEY_SERVICE_DLL_DEBUGFLAGS "DllDebugFlags"
57 
59 #define OPENCBM_DRIVERNAME "opencbm"
60 
65 #define CBMDEVICENAME_MAINPART "\\\\.\\" OPENCBM_DRIVERNAME
66 
70 // {9C3B5B5E-558E-47cc-9C05-F1FCF5175407}
71 DEFINE_GUID(GUID_OPENCBM, 0x9c3b5b5e, 0x558e, 0x47cc, 0x9c, 0x5, 0xf1, 0xfc, 0xf5, 0x17, 0x54, 0x7);
72 
74 #define IEC_LINE_DATA 0x01
75 
76 #define IEC_LINE_CLOCK 0x02
77 
78 #define IEC_LINE_ATN 0x04
79 
80 #define IEC_LINE_RESET 0x08
81 
82 
83 // Data structures for accessing the kernel mode driver:
84 
86 typedef
87 struct CBMT_IECADDRESS
88 {
91 
94 
96 
98 typedef
99 struct CBMT_SINGLEBYTE
100 {
102  UCHAR Byte;
103 
105 
107 typedef
108 struct CBMT_LINE
109 {
112  UCHAR Line;
113 
114 } CBMT_LINE;
115 
119 typedef
120 struct CBMT_LINESTATE
121 {
124  UCHAR Line;
125 
127  UCHAR State;
128 
130 
132 typedef
133 struct CBMT_BOOLEAN
134 {
136  BOOLEAN Decision;
137 
138 } CBMT_BOOLEAN;
139 
146 #define CBMT_I_INSTALL_OUT_GET_VERSION_MAJOR(_x) (((_x) >> 24) & 0xFF)
147 
148 #define CBMT_I_INSTALL_OUT_GET_VERSION_MINOR(_x) (((_x) >> 16) & 0xFF)
149 
150 #define CBMT_I_INSTALL_OUT_GET_VERSION_SUBMINOR(_x) (((_x) >> 8) & 0xFF)
151 
152 #define CBMT_I_INSTALL_OUT_GET_VERSION_DEVEL(_x) (((_x) >> 0) & 0xFF)
153 
155 #define CBMT_I_INSTALL_OUT_MAKE_VERSION(_x, _y, _z, _w) \
156  (((((_x) << 8 | (_y)) << 8 | (_z)) << 8 | (_w)))
157 
158 
160 #define CBMT_I_INSTALL_OUT_GET_VERSION_EX_BUGFIX(_x) (((_x) >> 0) & 0xFF)
161 
163 #define CBMT_I_INSTALL_OUT_MAKE_VERSION_EX(_w) \
164  (_w)
165 
167 typedef
168 struct CBMT_I_INSTALL_OUT
169 {
173  ULONG ErrorFlags;
174 
176  ULONG DllVersion;
177 
180 
183 
186 
188 
193 typedef
194 struct CBMT_I_TESTIRQ
195 {
199 
203 
207 
209 
211 typedef
212 struct CBMT_IEC_DBG_VALUE
213 {
214  UCHAR Value;
216 
251 
252 
254 #define CBMCTRL_BASE 0x0000A424
255 
256 #define OPENCBM_IOCTL_INDEX 0x823
257 
259 #define _CBMIO(_a,_b) CTL_CODE(CBMCTRL_BASE, (OPENCBM_IOCTL_INDEX+(_b)), \
260  METHOD_BUFFERED, FILE_ANY_ACCESS)
261 
262  // INPUT: OUTPUT:
264 #define CBMCTRL_TALK _CBMIO(CBMCTRL_BASE, 0) // CBMT_TALK_IN -
265 #define CBMCTRL_LISTEN _CBMIO(CBMCTRL_BASE, 1) // CBMT_LISTEN_IN -
267 #define CBMCTRL_UNTALK _CBMIO(CBMCTRL_BASE, 2) // - -
269 #define CBMCTRL_UNLISTEN _CBMIO(CBMCTRL_BASE, 3) // - -
271 #define CBMCTRL_OPEN _CBMIO(CBMCTRL_BASE, 4) // CBMT_OPEN_IN -
273 #define CBMCTRL_CLOSE _CBMIO(CBMCTRL_BASE, 5) // CBMT_CLOSE_IN -
275 #define CBMCTRL_RESET _CBMIO(CBMCTRL_BASE, 6) // - -
277 #define CBMCTRL_GET_EOI _CBMIO(CBMCTRL_BASE, 7) // - CBMT_GET_EOI_OUT
279 #define CBMCTRL_CLEAR_EOI _CBMIO(CBMCTRL_BASE, 8) // - -
281 
283 #define CBMCTRL_PP_READ _CBMIO(CBMCTRL_BASE, 10) // - CBMT_PP_READ_OUT
284 #define CBMCTRL_PP_WRITE _CBMIO(CBMCTRL_BASE, 11) // CBMT_PP_WRITE_IN -
286 #define CBMCTRL_IEC_POLL _CBMIO(CBMCTRL_BASE, 12) // - CBMT_IEC_POLL_OUT
288 #define CBMCTRL_IEC_SET _CBMIO(CBMCTRL_BASE, 13) // CBMT_IEC_SET_IN -
290 #define CBMCTRL_IEC_RELEASE _CBMIO(CBMCTRL_BASE, 14) // CBMT_IEC_RELEASE_IN -
292 #define CBMCTRL_IEC_WAIT _CBMIO(CBMCTRL_BASE, 15) // CBMT_IEC_WAIT_IN CBMT_IEC_WAIT_OUT
294 
296 #define CBMCTRL_I_INSTALL _CBMIO(CBMCTRL_BASE, 16) // - CBMT_I_INSTALL_OUT (or an array of it)
297 
298 #if DBG
299 #define CBMCTRL_I_READDBG _CBMIO(CBMCTRL_BASE, 17) // - char array which will be filled
301 #endif // #if DBG
302 
304 #define CBMCTRL_IEC_SETRELEASE _CBMIO(CBMCTRL_BASE, 18) // CBMT_IEC_SETRELEASE_IN -
305 
307 #define CBMCTRL_PARBURST_READ \
308  _CBMIO(CBMCTRL_BASE, 19) // CBMT_IEC_PARBURST_PREAD_IN -
309 
311 #define CBMCTRL_PARBURST_WRITE \
312  _CBMIO(CBMCTRL_BASE, 20) // - CBMT_IEC_PARBURST_PWRITE_OUT
313 
315 #define CBMCTRL_PARBURST_READ_TRACK \
316  _CBMIO(CBMCTRL_BASE, 21) // - CBMT_PARBURST_READ_TRACK_OUT
317 
319 #define CBMCTRL_PARBURST_WRITE_TRACK \
320  _CBMIO(CBMCTRL_BASE, 22) // CBMT_PARBURST_WRITE_TRACK_IN -
321 
323 #define CBMCTRL_PARPORT_LOCK \
324  _CBMIO(CBMCTRL_BASE, 23) // - -
325 
327 #define CBMCTRL_PARPORT_UNLOCK \
328  _CBMIO(CBMCTRL_BASE, 24) // - -
329 
331 #define CBMCTRL_UPDATE \
332  _CBMIO(CBMCTRL_BASE, 25) // - -
333 
335 #define CBMCTRL_TEST_IRQ \
336  _CBMIO(CBMCTRL_BASE, 26) // - -
337 
339 #define CBMCTRL_IEC_DBG_READ _CBMIO(CBMCTRL_BASE, 27) // CBMT_IEC_DBG_READ -
340 
342 #define CBMCTRL_IEC_DBG_WRITE _CBMIO(CBMCTRL_BASE, 28) // - CBMT_IEC_DBG_WRITE
343 
344 
346 #define CBMCTRL_PARBURST_READ_TRACK_VAR \
347  _CBMIO(CBMCTRL_BASE, 29) // - CBMT_PARBURST_READ_TRACK_OUT
348 
349 /* these are the return codes of CBMCTRL_I_INSTALL: */
350 
352 #define CBM_I_DRIVER_INSTALL_0_FAILED 0xFFFFFFFF
353 #define CBM_I_DRIVER_INSTALL_0_IOCTL_FAILED 0xFFFFFFFE
355 #define CBM_I_DRIVER_INSTALL_0M_NO_INTERRUPT 0x80000000
357 
358 #endif /* #ifndef CBM_IOCTL_H */
CBMT_IECADDRESS CBMT_OPEN_IN
Definition: cbmioctl.h:222
CBMT_IEC_DBG_VALUE CBMT_IEC_DBG_READ
Definition: cbmioctl.h:248
struct CBMT_IEC_DBG_VALUE CBMT_IEC_DBG_VALUE
CBMT_IECADDRESS CBMT_LISTEN_IN
Definition: cbmioctl.h:220
enum iec_cabletype IEC_CABLETYPE
struct CBMT_I_INSTALL_OUT CBMT_I_INSTALL_OUT
CBMT_SINGLEBYTE CBMT_PP_READ_OUT
Definition: cbmioctl.h:228
CBMT_LINE_STATE CBMT_IEC_SETRELEASE_IN
Definition: cbmioctl.h:242
ULONG DriverVersionEx
Definition: cbmioctl.h:185
CBMT_LINE_STATE CBMT_IEC_WAIT_IN
Definition: cbmioctl.h:232
UCHAR PrimaryAddress
Definition: cbmioctl.h:90
CBMT_LINE CBMT_IEC_RELEASE_IN
Definition: cbmioctl.h:238
CBMT_SINGLEBYTE CBMT_PARBURST_PWRITE_IN
Definition: cbmioctl.h:246
struct CBMT_I_TESTIRQ CBMT_I_TESTIRQ
DEFINE_GUID(GUID_OPENCBM, 0x9c3b5b5e, 0x558e, 0x47cc, 0x9c, 0x5, 0xf1, 0xfc, 0xf5, 0x17, 0x54, 0x7)
UCHAR SecondaryAddress
Definition: cbmioctl.h:93
CBMT_SINGLEBYTE CBMT_PP_WRITE_IN
Definition: cbmioctl.h:226
struct CBMT_SINGLEBYTE CBMT_SINGLEBYTE
CHAR ErrAcquireIrq
Definition: cbmioctl.h:198
iec_cabletype
Definition: cbmioctl.h:26
BOOLEAN Decision
Definition: cbmioctl.h:136
CBMT_IECADDRESS CBMT_CLOSE_IN
Definition: cbmioctl.h:224
CBMT_LINE CBMT_IEC_SET_IN
Definition: cbmioctl.h:236
CBMT_SINGLEBYTE CBMT_PARBURST_PREAD_OUT
Definition: cbmioctl.h:244
struct CBMT_BOOLEAN CBMT_BOOLEAN
CBMT_LINE CBMT_IEC_WAIT_OUT
Definition: cbmioctl.h:234
struct CBMT_LINESTATE CBMT_LINE_STATE
CBMT_BOOLEAN CBMT_GET_EOI_OUT
Definition: cbmioctl.h:240
CHAR ErrIrqFallingEdge
Definition: cbmioctl.h:206
struct CBMT_LINE CBMT_LINE
CBMT_IEC_DBG_VALUE CBMT_IEC_DBG_WRITE
Definition: cbmioctl.h:250
UCHAR Line
Definition: cbmioctl.h:112
CHAR ErrIrqRisingEdge
Definition: cbmioctl.h:202
CBMT_IECADDRESS CBMT_TALK_IN
Definition: cbmioctl.h:218
struct CBMT_IECADDRESS CBMT_IECADDRESS
CBMT_LINE CBMT_IEC_POLL_OUT
Definition: cbmioctl.h:230