OpenCBM
ioctl.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2004-2009 Spiro Trikaliotis
8  * Copyright 2009 Arnd <arnd(at)jonnz(dot)de>
9  *
10  */
11 
20 #include <wdm.h>
21 #include "cbm_driver.h"
22 #include "cbmioctl.h"
23 #include "iec.h"
24 
25 #include <parallel.h>
26 
27 
45 static NTSTATUS
46 cbm_checkinputbuffer(IN PIO_STACK_LOCATION IrpSp, USHORT Len, NTSTATUS StatusOnSuccess)
47 {
48  FUNC_ENTER();
49 
50  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < Len)
51  {
52  StatusOnSuccess = STATUS_BUFFER_TOO_SMALL;
53  }
54 
55  FUNC_LEAVE_NTSTATUS(StatusOnSuccess);
56 }
57 
75 static NTSTATUS
76 cbm_checkoutputbuffer(IN PIO_STACK_LOCATION IrpSp, USHORT Len, NTSTATUS StatusOnSuccess)
77 {
78  FUNC_ENTER();
79 
80  if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < Len)
81  {
82  StatusOnSuccess = STATUS_BUFFER_TOO_SMALL;
83  }
84 
85  FUNC_LEAVE_NTSTATUS(StatusOnSuccess);
86 }
87 
114 NTSTATUS
115 cbm_devicecontrol(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
116 {
117  PPAR_SET_INFORMATION setInfo;
118  PIO_STACK_LOCATION irpSp;
119  PDEVICE_EXTENSION pdx;
120  NTSTATUS ntStatus;
121  BOOLEAN fastStart;
122 
123  FUNC_ENTER();
124 
125  // get the device extension
126 
127  pdx = Fdo->DeviceExtension;
128 
129  // get the current IRP stack location
130 
131  irpSp = IoGetCurrentIrpStackLocation(Irp);
132 
133 
134  DBG_IRPPATH_PROCESS("Ioctl");
135 
136  // assume we do not want to perform a faststart of this IRP
137 
138  fastStart = FALSE;
139 
140  // Now, check the input and/or output buffers of the given
141  // IOCTLs if they are at least as big as the specification.
142  // If not, the IRP (and thus the IOCTL) is failed
143 
144  switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {
145 
146  case CBMCTRL_TALK:
147  DBG_IRP(CBMCTRL_TALK);
148  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_TALK_IN), STATUS_SUCCESS);
149  break;
150 
151  case CBMCTRL_LISTEN:
152  DBG_IRP(CBMCTRL_LISTEN);
153  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_LISTEN_IN), STATUS_SUCCESS);
154  break;
155 
156  case CBMCTRL_UNTALK:
157  DBG_IRP(CBMCTRL_UNTALK);
158  ntStatus = STATUS_SUCCESS;
159  break;
160 
161  case CBMCTRL_UNLISTEN:
162  DBG_IRP(CBMCTRL_UNLISTEN);
163  ntStatus = STATUS_SUCCESS;
164  break;
165 
166  case CBMCTRL_OPEN:
167  DBG_IRP(CBMCTRL_OPEN);
168  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_OPEN_IN), STATUS_SUCCESS);
169  break;
170 
171  case CBMCTRL_CLOSE:
172  DBG_IRP(CBMCTRL_CLOSE);
173  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_CLOSE_IN), STATUS_SUCCESS);
174  break;
175 
176  case CBMCTRL_RESET:
177  DBG_IRP(CBMCTRL_RESET);
178  ntStatus = STATUS_SUCCESS;
179  break;
180 
181  case CBMCTRL_GET_EOI:
182  DBG_IRP(CBMCTRL_GET_EOI);
183  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_GET_EOI_OUT), STATUS_SUCCESS);
184  fastStart = TRUE;
185  break;
186 
187  case CBMCTRL_CLEAR_EOI:
188  DBG_IRP(CBMCTRL_CLEAR_EOI);
189  ntStatus = STATUS_SUCCESS;
190  fastStart = TRUE;
191  break;
192 
193  case CBMCTRL_PP_READ:
194  DBG_IRP(CBMCTRL_PP_READ);
195  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PP_READ_OUT), STATUS_SUCCESS);
196  fastStart = TRUE;
197  break;
198 
199  case CBMCTRL_PP_WRITE:
200  DBG_IRP(CBMCTRL_PP_WRITE);
201  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_PP_WRITE_IN), STATUS_SUCCESS);
202  fastStart = TRUE;
203  break;
204 
205  case CBMCTRL_IEC_POLL:
206  DBG_IRP(CBMCTRL_IEC_POLL);
207  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_IEC_POLL_OUT), STATUS_SUCCESS);
208  fastStart = TRUE;
209  break;
210 
211  case CBMCTRL_IEC_SET:
212  DBG_IRP(CBMCTRL_IEC_SET);
213  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_SET_IN), STATUS_SUCCESS);
214  fastStart = TRUE;
215  break;
216 
217  case CBMCTRL_IEC_RELEASE:
218  DBG_IRP(CBMCTRL_IEC_RELEASE);
219  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_RELEASE_IN), STATUS_SUCCESS);
220  fastStart = TRUE;
221  break;
222 
224  DBG_IRP(CBMCTRL_IEC_SETRELEASE);
225  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_SETRELEASE_IN), STATUS_SUCCESS);
226  fastStart = TRUE;
227  break;
228 
229  case CBMCTRL_IEC_WAIT:
230  DBG_IRP(CBMCTRL_IEC_WAIT);
231  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_IEC_WAIT_OUT),
232  cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_WAIT_IN), STATUS_SUCCESS));
233  break;
234 
236  DBG_IRP(CBMCTRL_PARBURST_READ);
237  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PARBURST_PREAD_OUT), STATUS_SUCCESS);
238  break;
239 
241  DBG_IRP(CBMCTRL_PARBURST_WRITE);
242  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_PARBURST_PWRITE_IN), STATUS_SUCCESS);
243  break;
244 
247  ntStatus = cbm_checkoutputbuffer(irpSp, 1, STATUS_SUCCESS);
248  break;
249 
252  ntStatus = cbm_checkoutputbuffer(irpSp, 1, STATUS_SUCCESS);
253  break;
254 
257  ntStatus = cbm_checkinputbuffer(irpSp, 1, STATUS_SUCCESS);
258  break;
259 
260  case CBMCTRL_I_INSTALL:
261  DBG_IRP(CBMCTRL_I_INSTALL);
262  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_I_INSTALL_OUT), STATUS_SUCCESS);
263  break;
264 
266  DBG_IRP(CBMCTRL_PARPORT_LOCK);
267  ntStatus = STATUS_SUCCESS;
268  break;
269 
271  DBG_IRP(CBMCTRL_PARPORT_UNLOCK);
272  ntStatus = STATUS_SUCCESS;
273  break;
274 
275  case CBMCTRL_UPDATE:
276  DBG_IRP(CBMCTRL_UPDATE);
277  ntStatus = STATUS_SUCCESS;
278  break;
279 
280  case CBMCTRL_TEST_IRQ:
281  DBG_IRP(CBMCTRL_TEST_IRQ);
282  ntStatus = STATUS_SUCCESS;
283  break;
284 
285 #if DBG
286 
287  case CBMCTRL_I_READDBG:
288  DBG_IRP(CBMCTRL_I_READDBG);
289  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CHAR), STATUS_SUCCESS);
290  break;
291 
292 #endif // #if DBG
293 
295  DBG_IRP(CBMCTRL_IEC_DBG_READ);
296  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_IEC_DBG_READ), STATUS_SUCCESS);
297  fastStart = TRUE;
298  break;
299 
301  DBG_IRP(CBMCTRL_IEC_DBG_WRITE);
302  ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_DBG_WRITE), STATUS_SUCCESS);
303  fastStart = TRUE;
304  break;
305 
306  default:
307  DBG_ERROR((DBG_PREFIX "unknown IRP_MJ_DEVICE_CONTROL"));
308  ntStatus = STATUS_INVALID_PARAMETER;
309  break;
310  }
311 
312  if (NT_SUCCESS(ntStatus))
313  {
314  PERF_EVENT_IOCTL_QUEUE(irpSp->Parameters.DeviceIoControl.IoControlCode);
315 
316  // queue the IRP to be processed
317  // If faststart is TRUE, it will be processed immediately
318  // (for performance reasons)
319 
320  ntStatus = QueueStartPacket(&pdx->IrpQueue, Irp, fastStart, Fdo);
321  }
322  else
323  {
324  // there was an error, complete the request
325  // with that error status
326 
327  QueueCompleteIrp(NULL, Irp, ntStatus, 0);
328  }
329 
330  FUNC_LEAVE_NTSTATUS(ntStatus);
331 }
332 
336 #define INPUTVALUE(_ttt_) ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
337 
341 #define OUTPUTVALUE(_ttt_) ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
342 
362 NTSTATUS
363 cbm_execute_devicecontrol(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
364 {
365  PPAR_SET_INFORMATION setInfo;
366  PIO_STACK_LOCATION irpSp;
367  ULONG_PTR returnLength;
368  NTSTATUS ntStatus;
369 
370  FUNC_ENTER();
371 
372  // As not every IOCTL needs to return a value, we initialize
373  // the return length here. This way, it needs only be altered
374  // if the IOCTL returns some value.
375 
376  returnLength = 0;
377 
378  // get the current IRP stack location
379 
380  irpSp = IoGetCurrentIrpStackLocation(Irp);
381 
382  PERF_EVENT_IOCTL_EXECUTE(irpSp->Parameters.DeviceIoControl.IoControlCode);
383 
384  DBG_IRPPATH_EXECUTE("Execute Ioctl");
385 
386  // Call the appropriate function for processing the IOCTL
387  // PrimaryAddresses are ANDed with 0x1F, as these are the only legitimate
388  // primary addresses allowed for a IEC serial bus.
389 
390  switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {
391 
392  case CBMCTRL_TALK:
393  DBG_IRP(CBMCTRL_TALK);
394  ntStatus = cbmiec_talk(Pdx, INPUTVALUE(CBMT_TALK_IN)->PrimaryAddress & 0x1F,
395  INPUTVALUE(CBMT_TALK_IN)->SecondaryAddress);
396  break;
397 
398  case CBMCTRL_LISTEN:
399  DBG_IRP(CBMCTRL_LISTEN);
400  ntStatus = cbmiec_listen(Pdx, INPUTVALUE(CBMT_LISTEN_IN)->PrimaryAddress & 0x1F,
401  INPUTVALUE(CBMT_LISTEN_IN)->SecondaryAddress);
402  break;
403 
404  case CBMCTRL_UNTALK:
405  DBG_IRP(CBMCTRL_UNTALK);
406  ntStatus = cbmiec_untalk(Pdx);
407  break;
408 
409  case CBMCTRL_UNLISTEN:
410  DBG_IRP(CBMCTRL_UNLISTEN);
411  ntStatus = cbmiec_unlisten(Pdx);
412  break;
413 
414  case CBMCTRL_OPEN:
415  DBG_IRP(CBMCTRL_OPEN);
416  ntStatus = cbmiec_open(Pdx, INPUTVALUE(CBMT_OPEN_IN)->PrimaryAddress & 0x1F,
417  INPUTVALUE(CBMT_OPEN_IN)->SecondaryAddress);
418  break;
419 
420  case CBMCTRL_CLOSE:
421  DBG_IRP(CBMCTRL_CLOSE);
422  ntStatus = cbmiec_close(Pdx,INPUTVALUE(CBMT_CLOSE_IN)->PrimaryAddress & 0x1F,
423  INPUTVALUE(CBMT_CLOSE_IN)->SecondaryAddress);
424  break;
425 
426  case CBMCTRL_RESET:
427  DBG_IRP(CBMCTRL_RESET);
428  ntStatus = cbmiec_reset(Pdx);
429  break;
430 
431  case CBMCTRL_GET_EOI:
432  DBG_IRP(CBMCTRL_GET_EOI);
433  returnLength = sizeof(CBMT_GET_EOI_OUT);
434  ntStatus = cbmiec_get_eoi(Pdx, &(OUTPUTVALUE(CBMT_GET_EOI_OUT)->Decision));
435  break;
436 
437  case CBMCTRL_CLEAR_EOI:
438  DBG_IRP(CBMCTRL_CLEAR_EOI);
439  ntStatus = cbmiec_clear_eoi(Pdx);
440  break;
441 
442  case CBMCTRL_PP_READ:
443  DBG_IRP(CBMCTRL_PP_READ);
444  ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PP_READ_OUT), STATUS_SUCCESS);
445  returnLength = sizeof(CBMT_PP_READ_OUT);
446  ntStatus = cbmiec_pp_read(Pdx, &(OUTPUTVALUE(CBMT_PP_READ_OUT)->Byte));
447  break;
448 
449  case CBMCTRL_PP_WRITE:
450  DBG_IRP(CBMCTRL_PP_WRITE);
451  ntStatus = cbmiec_pp_write(Pdx, INPUTVALUE(CBMT_PP_WRITE_IN)->Byte);
452  break;
453 
454  case CBMCTRL_IEC_POLL:
455  DBG_IRP(CBMCTRL_IEC_POLL);
456  returnLength = sizeof(CBMT_IEC_POLL_OUT);
457  ntStatus = cbmiec_iec_poll(Pdx, &(OUTPUTVALUE(CBMT_IEC_POLL_OUT)->Line));
458  break;
459 
460  case CBMCTRL_IEC_SET:
461  DBG_IRP(CBMCTRL_IEC_SET);
462  ntStatus = cbmiec_iec_set(Pdx, INPUTVALUE(CBMT_IEC_SET_IN)->Line);
463  break;
464 
465  case CBMCTRL_IEC_RELEASE:
466  DBG_IRP(CBMCTRL_IEC_RELEASE);
467  ntStatus = cbmiec_iec_release(Pdx, INPUTVALUE(CBMT_IEC_RELEASE_IN)->Line);
468  break;
469 
471  DBG_IRP(CBMCTRL_IEC_SETRELEASE);
472  ntStatus = cbmiec_iec_setrelease(Pdx,
475  break;
476 
477  case CBMCTRL_IEC_WAIT:
478  DBG_IRP(CBMCTRL_IEC_WAIT);
479  returnLength = sizeof(CBMT_IEC_WAIT_OUT);
480  ntStatus = cbmiec_iec_wait(Pdx, INPUTVALUE(CBMT_IEC_WAIT_IN)->Line,
482  &(OUTPUTVALUE(CBMT_IEC_WAIT_OUT)->Line));
483  break;
484 
486  DBG_IRP(CBMCTRL_PARBURST_READ);
487  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
489  break;
490 
492  DBG_IRP(CBMCTRL_PARBURST_READ);
493  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
495  break;
496 
499  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
500  ntStatus = cbmiec_parallel_burst_read_track(Pdx,
501  Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
502  break;
503 
506  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
507  ntStatus = cbmiec_parallel_burst_read_track_var(Pdx,
508  Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
509  break;
510 
513  returnLength = irpSp->Parameters.DeviceIoControl.InputBufferLength;
514  ntStatus = cbmiec_parallel_burst_write_track(Pdx,
515  Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
516  break;
517 
518  case CBMCTRL_I_INSTALL:
519  DBG_IRP(CBMCTRL_I_INSTALL);
520  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
521  ntStatus = cbm_install(Pdx, OUTPUTVALUE(CBMT_I_INSTALL_OUT), (PULONG) &returnLength);
522  break;
523 
525  DBG_IRP(CBMCTRL_PARPORT_LOCK);
526  ntStatus = cbm_lock(Pdx);
527  break;
528 
530  DBG_IRP(CBMCTRL_PARPORT_UNLOCK);
531  ntStatus = cbm_unlock(Pdx);
532  break;
533 
534  case CBMCTRL_UPDATE:
535  DBG_IRP(CBMCTRL_UPDATE);
536 
537  DBG_IRQL( <= DISPATCH_LEVEL);
538  IoStopTimer(Pdx->Fdo);
539 
540  cbm_init_registry(NULL, Pdx);
541 
542  //
543  // If requested by the registry, lock the parallel port
544  //
545 
546  if (Pdx->ParallelPortLock && Pdx->ParallelPortIsLocked == FALSE)
547  {
548  cbm_lock_parport(Pdx);
549  }
550 
551  ntStatus = STATUS_SUCCESS;
552  break;
553 
554  case CBMCTRL_TEST_IRQ:
555  DBG_IRP(CBMCTRL_TEST_IRQ);
556  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
557  ntStatus = cbmiec_test_irq(Pdx,
558  Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
559  break;
560 
561 #if DBG
562 
563  case CBMCTRL_I_READDBG:
564  DBG_IRP(CBMCTRL_I_READDBG);
565  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
566  ntStatus = cbm_dbg_readbuffer(Pdx, OUTPUTVALUE(CHAR), (PULONG) &returnLength);
567  break;
568 
569 #endif // #if DBG
570 
572  DBG_IRP(CBMCTRL_IEC_DBG_READ);
573  returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
574  returnLength = sizeof(CBMT_IEC_DBG_READ);
575  ntStatus = cbmiec_iec_dbg_read(Pdx, &(OUTPUTVALUE(CBMT_IEC_DBG_READ)->Value));
576  break;
577 
579  DBG_IRP(CBMCTRL_IEC_DBG_WRITE);
580  ntStatus = cbmiec_iec_dbg_write(Pdx, INPUTVALUE(CBMT_IEC_DBG_WRITE)->Value);
581  break;
582 
583  default:
584  // As cbm_devicecontrol() already checked the IRP,
585  // this piece of code should never be entered. If it
586  // is, this is a sign of a forgotten IOCTL, or a severe
587  // programming error
588 
589  DBG_ERROR((DBG_PREFIX "unknown IRP_MJ_DEVICE_CONTROL"));
590  DBG_ASSERT(("THIS SHOULD NOT HAPPEN!", 0));
591  ntStatus = STATUS_INVALID_PARAMETER;
592  break;
593  }
594 
595  // If an error occurred, make sure not to return anything.
596 
597  if (!NT_SUCCESS(ntStatus))
598  {
599  returnLength = 0;
600  }
601 
602  // Complete the request:
603 
604  DBG_IRPPATH_COMPLETE("Execute Ioctl");
605  QueueCompleteIrp(&Pdx->IrpQueue, Irp, ntStatus, returnLength);
606 
607  FUNC_LEAVE_NTSTATUS(ntStatus);
608 }
#define CBMCTRL_PARPORT_UNLOCK
IOCTL for locking the driver onto the parallel port.
Definition: cbmioctl.h:327
#define CBMCTRL_PARBURST_READ_TRACK
IOCTL for reading a complete track (for parallel burst)
Definition: cbmioctl.h:315
CBMT_IEC_DBG_VALUE CBMT_IEC_DBG_READ
Definition: cbmioctl.h:248
NTSTATUS cbmiec_clear_eoi(IN PDEVICE_EXTENSION Pdx)
Reset the EOI state.
Definition: eoi.c:61
NTSTATUS cbm_execute_devicecontrol(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Executes IOCTLs.
Definition: ioctl.c:363
#define CBMCTRL_TEST_IRQ
IOCTL for testing the interrupt facilities of the hardware.
Definition: cbmioctl.h:335
#define DBG_IRPPATH_PROCESS(_Where_)
Debug IRPPATH: Processing of the IRP.
Definition: debug.h:571
#define CBMCTRL_I_READDBG
IOCTL reading the debug buffer of the driver; ONLY FOR USE OF INSTCBM!
Definition: cbmioctl.h:300
NTSTATUS cbmiec_iec_wait(IN PDEVICE_EXTENSION Pdx, IN UCHAR Line, IN UCHAR State, OUT PUCHAR Result)
Wait for a line to have a specific value.
Definition: wait.c:45
void CBMAPIDECL cbm_unlock(CBM_FILE HandleDevice)
Unlock the parallel port for the driver.
Definition: cbm.c:832
#define PERF_EVENT_IOCTL_EXECUTE(_x_)
Definition: cbm_driver.h:49
#define CBMCTRL_IEC_SET
IOCTL for setting an IEC line.
Definition: cbmioctl.h:289
#define CBMCTRL_LISTEN
IOCTL for sending a LISTEN command.
Definition: cbmioctl.h:266
#define CBMCTRL_I_INSTALL
IOCTL for performing und checking the installation; ONLY FOR USE OF INSTCBM!
Definition: cbmioctl.h:296
#define CBMCTRL_TALK
IOCTL for sending a TALK command.
Definition: cbmioctl.h:264
CBMT_SINGLEBYTE CBMT_PP_READ_OUT
Definition: cbmioctl.h:228
#define CBMCTRL_UNLISTEN
IOCTL for sending an UNLISTEN command.
Definition: cbmioctl.h:270
#define PERF_EVENT_IOCTL_QUEUE(_x_)
Definition: cbm_driver.h:47
#define CBMCTRL_IEC_RELEASE
IOCTL for releasing an IEC line.
Definition: cbmioctl.h:291
NTSTATUS cbmiec_untalk(IN PDEVICE_EXTENSION Pdx)
Send an UNTALK over the IEC bus.
Definition: untalk.c:38
#define CBMCTRL_IEC_SETRELEASE
IOCTL for setting and releasing IEC lines at once.
Definition: cbmioctl.h:304
Define the IOCTL codes for the opencbm driver.
NTSTATUS cbmiec_iec_setrelease(IN PDEVICE_EXTENSION Pdx, IN USHORT Set, IN USHORT Release)
Activate and deactive a line on the IEC serial bus.
Definition: setrelease.c:59
NTSTATUS cbmiec_close(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Close a file on the IEC bus.
#define CBMCTRL_PARBURST_WRITE
IOCTL for writing to the parallel port (for controlling parallel burst)
Definition: cbmioctl.h:311
NTSTATUS cbmiec_get_eoi(IN PDEVICE_EXTENSION Pdx, OUT PBOOLEAN Result)
Check if an EOI signal has been sent over the IEC bus.
Definition: eoi.c:40
Definitions for the libiec library.
#define CBMCTRL_GET_EOI
IOCTL for getting the EOI state.
Definition: cbmioctl.h:278
void CBMAPIDECL cbm_lock(CBM_FILE HandleDevice)
Lock the parallel port for the driver.
Definition: cbm.c:804
NTSTATUS QueueStartPacket(PQUEUE Queue, PIRP Irp, BOOLEAN FastStart, PDEVICE_OBJECT Fdo)
Insert an IRP into a QUEUE object.
Definition: queue.c:467
NTSTATUS cbm_devicecontrol(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services IOCTLs.
Definition: ioctl.c:115
NTSTATUS cbm_dbg_readbuffer(IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer, IN OUT PULONG ReturnLength)
Give the debug buffer contents to the installer.
NTSTATUS cbmiec_unlisten(IN PDEVICE_EXTENSION Pdx)
Send an UNLISTEN over the IEC bus.
Definition: unlisten.c:38
#define CBMCTRL_PP_WRITE
IOCTL for setting the PP values.
Definition: cbmioctl.h:285
NTSTATUS cbmiec_iec_release(IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
Release a specific line on the IEC bus.
Definition: release.c:42
#define CBMCTRL_PARPORT_LOCK
IOCTL for locking the driver onto the parallel port.
Definition: cbmioctl.h:323
#define DBG_ASSERT(_xxx)
Definition: debug.h:401
#define INPUTVALUE(_ttt_)
Definition: ioctl.c:336
#define DBG_ERROR(_xxx)
Definition: debug.h:397
#define DBG_IRPPATH_COMPLETE(_Where_)
Debug IRPPATH: Completing of the IRP.
Definition: debug.h:574
#define CBMCTRL_PARBURST_READ
IOCTL for reading from the parallel port (for controlling parallel burst)
Definition: cbmioctl.h:307
NTSTATUS cbmiec_test_irq(IN PDEVICE_EXTENSION Pdx, OUT PVOID Buffer, IN ULONG BufferLength)
Test for IRQ capabilities.
Definition: testirq.c:41
NTSTATUS cbm_lock_parport(IN PDEVICE_EXTENSION Pdx)
Lock the parallel port for the driver.
Definition: lockunlock.c:39
#define CBMCTRL_PARBURST_WRITE_TRACK
IOCTL for writing a complete track (for parallel burst)
Definition: cbmioctl.h:319
NTSTATUS cbmiec_listen(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Send a LISTEN over the IEC bus.
Definition: listen.c:44
VOID cbm_init_registry(IN PUNICODE_STRING RegistryPath, IN PDEVICE_EXTENSION Pdx)
Initialize from registry.
#define CBMCTRL_PARBURST_READ_TRACK_VAR
IOCTL for reading a variable length track (for parallel burst)
Definition: cbmioctl.h:346
NTSTATUS cbmiec_talk(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Send a TALK over the IEC bus.
Definition: talk.c:44
#define CBMCTRL_UNTALK
IOCTL for sending an UNTALK command.
Definition: cbmioctl.h:268
NTSTATUS cbmiec_reset(IN PDEVICE_EXTENSION Pdx)
Send a RESET to the IEC bus.
Definition: reset.c:103
#define CBMCTRL_UPDATE
IOCTL for updating settings of the driver.
Definition: cbmioctl.h:331
NTSTATUS cbmiec_open(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Open a file on the IEC bus.
#define CBMCTRL_PP_READ
IOCTL for reading the PP values.
Definition: cbmioctl.h:283
NTSTATUS cbmiec_iec_dbg_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Value)
Read a byte from the parallel port input register.
Definition: dbgread.c:51
#define CBMCTRL_RESET
IOCTL for sending a RESET.
Definition: cbmioctl.h:276
#define CBMCTRL_IEC_DBG_WRITE
IOCTL for debugging a cable: Write all the output lines in a hardware-specific way.
Definition: cbmioctl.h:342
#define CBMCTRL_IEC_POLL
IOCTL for polling an IEC line.
Definition: cbmioctl.h:287
#define CBMCTRL_IEC_DBG_READ
IOCTL for debugging a cable: Read all the input lines in a hardware-specific way. ...
Definition: cbmioctl.h:339
#define FUNC_ENTER()
Definition: debug.h:347
NTSTATUS cbm_install(IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
Complete driver installation.
Definitions for the opencbm driver.
#define DBG_IRPPATH_EXECUTE(_Where_)
Debug IRPPATH: Executing of the IRP.
Definition: debug.h:580
#define CBMCTRL_CLEAR_EOI
IOCTL for resetting the EOI state.
Definition: cbmioctl.h:280
#define DBG_PREFIX
Definition: debug.h:320
NTSTATUS cbmiec_parallel_burst_read_track_var(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
@@@
Definition: mnib.c:371
NTSTATUS cbmiec_iec_poll(IN PDEVICE_EXTENSION Pdx, OUT PUCHAR Result)
Polls the status of the lines on the IEC bus.
Definition: poll.c:39
NTSTATUS cbmiec_parallel_burst_read_track(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
@@@
Definition: mnib.c:304
CBMT_LINE CBMT_IEC_WAIT_OUT
Definition: cbmioctl.h:234
#define CBMCTRL_IEC_WAIT
IOCTL for waiting for an IEC line.
Definition: cbmioctl.h:293
#define CBMCTRL_OPEN
IOCTL for sending an OPEN command.
Definition: cbmioctl.h:272
NTSTATUS QueueCompleteIrp(PQUEUE Queue, PIRP Irp, NTSTATUS StatusCode, ULONG_PTR Information)
Complete an IRP which is on a QUEUE.
Definition: queue.c:756
#define CBMCTRL_CLOSE
IOCTL for sending a CLOSE command.
Definition: cbmioctl.h:274
NTSTATUS cbmiec_iec_set(IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
Set a specific line on the IEC bus.
Definition: set.c:42
CBMT_BOOLEAN CBMT_GET_EOI_OUT
Definition: cbmioctl.h:240
NTSTATUS cbmiec_pp_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
Write a byte to the X[M|A]P1541 cable.
Definition: ppwrite.c:42
#define OUTPUTVALUE(_ttt_)
Definition: ioctl.c:341
NTSTATUS cbmiec_iec_dbg_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Value)
Write a byte to the parallel port output register.
Definition: dbgwrite.c:56
NTSTATUS cbmiec_parallel_burst_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
@@@
Definition: mnib.c:134
NTSTATUS cbmiec_pp_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
Read a byte from the X[M|A]P1541 cable.
Definition: ppread.c:79
NTSTATUS cbmiec_parallel_burst_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
@@@
Definition: mnib.c:79
CBMT_LINE CBMT_IEC_POLL_OUT
Definition: cbmioctl.h:230