46 cbm_checkinputbuffer(IN PIO_STACK_LOCATION IrpSp, USHORT Len, NTSTATUS StatusOnSuccess)
50 if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < Len)
52 StatusOnSuccess = STATUS_BUFFER_TOO_SMALL;
55 FUNC_LEAVE_NTSTATUS(StatusOnSuccess);
76 cbm_checkoutputbuffer(IN PIO_STACK_LOCATION IrpSp, USHORT Len, NTSTATUS StatusOnSuccess)
80 if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < Len)
82 StatusOnSuccess = STATUS_BUFFER_TOO_SMALL;
85 FUNC_LEAVE_NTSTATUS(StatusOnSuccess);
117 PPAR_SET_INFORMATION setInfo;
118 PIO_STACK_LOCATION irpSp;
119 PDEVICE_EXTENSION pdx;
127 pdx = Fdo->DeviceExtension;
131 irpSp = IoGetCurrentIrpStackLocation(Irp);
144 switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {
148 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_TALK_IN), STATUS_SUCCESS);
153 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_LISTEN_IN), STATUS_SUCCESS);
158 ntStatus = STATUS_SUCCESS;
163 ntStatus = STATUS_SUCCESS;
168 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_OPEN_IN), STATUS_SUCCESS);
173 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_CLOSE_IN), STATUS_SUCCESS);
178 ntStatus = STATUS_SUCCESS;
183 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(
CBMT_GET_EOI_OUT), STATUS_SUCCESS);
189 ntStatus = STATUS_SUCCESS;
195 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(
CBMT_PP_READ_OUT), STATUS_SUCCESS);
201 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_PP_WRITE_IN), STATUS_SUCCESS);
207 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(
CBMT_IEC_POLL_OUT), STATUS_SUCCESS);
213 ntStatus = cbm_checkinputbuffer(irpSp,
sizeof(
CBMT_IEC_SET_IN), STATUS_SUCCESS);
247 ntStatus = cbm_checkoutputbuffer(irpSp, 1, STATUS_SUCCESS);
252 ntStatus = cbm_checkoutputbuffer(irpSp, 1, STATUS_SUCCESS);
257 ntStatus = cbm_checkinputbuffer(irpSp, 1, STATUS_SUCCESS);
267 ntStatus = STATUS_SUCCESS;
272 ntStatus = STATUS_SUCCESS;
277 ntStatus = STATUS_SUCCESS;
282 ntStatus = STATUS_SUCCESS;
289 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(CHAR), STATUS_SUCCESS);
296 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(
CBMT_IEC_DBG_READ), STATUS_SUCCESS);
308 ntStatus = STATUS_INVALID_PARAMETER;
312 if (NT_SUCCESS(ntStatus))
330 FUNC_LEAVE_NTSTATUS(ntStatus);
336 #define INPUTVALUE(_ttt_) ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
341 #define OUTPUTVALUE(_ttt_) ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
365 PPAR_SET_INFORMATION setInfo;
366 PIO_STACK_LOCATION irpSp;
367 ULONG_PTR returnLength;
380 irpSp = IoGetCurrentIrpStackLocation(Irp);
390 switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {
444 ntStatus = cbm_checkoutputbuffer(irpSp,
sizeof(
CBMT_PP_READ_OUT), STATUS_SUCCESS);
487 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
493 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
499 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
501 Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
506 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
508 Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
513 returnLength = irpSp->Parameters.DeviceIoControl.InputBufferLength;
514 ntStatus = cbmiec_parallel_burst_write_track(Pdx,
515 Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
520 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
537 DBG_IRQL( <= DISPATCH_LEVEL);
538 IoStopTimer(Pdx->Fdo);
546 if (Pdx->ParallelPortLock && Pdx->ParallelPortIsLocked == FALSE)
551 ntStatus = STATUS_SUCCESS;
556 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
558 Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
565 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
573 returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
591 ntStatus = STATUS_INVALID_PARAMETER;
597 if (!NT_SUCCESS(ntStatus))
607 FUNC_LEAVE_NTSTATUS(ntStatus);
#define CBMCTRL_PARPORT_UNLOCK
IOCTL for locking the driver onto the parallel port.
#define CBMCTRL_PARBURST_READ_TRACK
IOCTL for reading a complete track (for parallel burst)
CBMT_IEC_DBG_VALUE CBMT_IEC_DBG_READ
NTSTATUS cbmiec_clear_eoi(IN PDEVICE_EXTENSION Pdx)
Reset the EOI state.
NTSTATUS cbm_execute_devicecontrol(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Executes IOCTLs.
#define CBMCTRL_TEST_IRQ
IOCTL for testing the interrupt facilities of the hardware.
#define DBG_IRPPATH_PROCESS(_Where_)
Debug IRPPATH: Processing of the IRP.
#define CBMCTRL_I_READDBG
IOCTL reading the debug buffer of the driver; ONLY FOR USE OF INSTCBM!
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.
void CBMAPIDECL cbm_unlock(CBM_FILE HandleDevice)
Unlock the parallel port for the driver.
#define PERF_EVENT_IOCTL_EXECUTE(_x_)
#define CBMCTRL_IEC_SET
IOCTL for setting an IEC line.
#define CBMCTRL_LISTEN
IOCTL for sending a LISTEN command.
#define CBMCTRL_I_INSTALL
IOCTL for performing und checking the installation; ONLY FOR USE OF INSTCBM!
#define CBMCTRL_TALK
IOCTL for sending a TALK command.
CBMT_SINGLEBYTE CBMT_PP_READ_OUT
#define CBMCTRL_UNLISTEN
IOCTL for sending an UNLISTEN command.
#define PERF_EVENT_IOCTL_QUEUE(_x_)
#define CBMCTRL_IEC_RELEASE
IOCTL for releasing an IEC line.
NTSTATUS cbmiec_untalk(IN PDEVICE_EXTENSION Pdx)
Send an UNTALK over the IEC bus.
#define CBMCTRL_IEC_SETRELEASE
IOCTL for setting and releasing IEC lines at once.
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.
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)
NTSTATUS cbmiec_get_eoi(IN PDEVICE_EXTENSION Pdx, OUT PBOOLEAN Result)
Check if an EOI signal has been sent over the IEC bus.
Definitions for the libiec library.
#define CBMCTRL_GET_EOI
IOCTL for getting the EOI state.
void CBMAPIDECL cbm_lock(CBM_FILE HandleDevice)
Lock the parallel port for the driver.
NTSTATUS QueueStartPacket(PQUEUE Queue, PIRP Irp, BOOLEAN FastStart, PDEVICE_OBJECT Fdo)
Insert an IRP into a QUEUE object.
NTSTATUS cbm_devicecontrol(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services IOCTLs.
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.
#define CBMCTRL_PP_WRITE
IOCTL for setting the PP values.
NTSTATUS cbmiec_iec_release(IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
Release a specific line on the IEC bus.
#define CBMCTRL_PARPORT_LOCK
IOCTL for locking the driver onto the parallel port.
#define INPUTVALUE(_ttt_)
#define DBG_IRPPATH_COMPLETE(_Where_)
Debug IRPPATH: Completing of the IRP.
#define CBMCTRL_PARBURST_READ
IOCTL for reading from the parallel port (for controlling parallel burst)
NTSTATUS cbmiec_test_irq(IN PDEVICE_EXTENSION Pdx, OUT PVOID Buffer, IN ULONG BufferLength)
Test for IRQ capabilities.
NTSTATUS cbm_lock_parport(IN PDEVICE_EXTENSION Pdx)
Lock the parallel port for the driver.
#define CBMCTRL_PARBURST_WRITE_TRACK
IOCTL for writing a complete track (for parallel burst)
NTSTATUS cbmiec_listen(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Send a LISTEN over the IEC bus.
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)
NTSTATUS cbmiec_talk(IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
Send a TALK over the IEC bus.
#define CBMCTRL_UNTALK
IOCTL for sending an UNTALK command.
NTSTATUS cbmiec_reset(IN PDEVICE_EXTENSION Pdx)
Send a RESET to the IEC bus.
#define CBMCTRL_UPDATE
IOCTL for updating settings of the driver.
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.
NTSTATUS cbmiec_iec_dbg_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Value)
Read a byte from the parallel port input register.
#define CBMCTRL_RESET
IOCTL for sending a RESET.
#define CBMCTRL_IEC_DBG_WRITE
IOCTL for debugging a cable: Write all the output lines in a hardware-specific way.
#define CBMCTRL_IEC_POLL
IOCTL for polling an IEC line.
#define CBMCTRL_IEC_DBG_READ
IOCTL for debugging a cable: Read all the input lines in a hardware-specific way. ...
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.
#define CBMCTRL_CLEAR_EOI
IOCTL for resetting the EOI state.
NTSTATUS cbmiec_parallel_burst_read_track_var(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
@@@
NTSTATUS cbmiec_iec_poll(IN PDEVICE_EXTENSION Pdx, OUT PUCHAR Result)
Polls the status of the lines on the IEC bus.
NTSTATUS cbmiec_parallel_burst_read_track(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
@@@
CBMT_LINE CBMT_IEC_WAIT_OUT
#define CBMCTRL_IEC_WAIT
IOCTL for waiting for an IEC line.
#define CBMCTRL_OPEN
IOCTL for sending an OPEN command.
NTSTATUS QueueCompleteIrp(PQUEUE Queue, PIRP Irp, NTSTATUS StatusCode, ULONG_PTR Information)
Complete an IRP which is on a QUEUE.
#define CBMCTRL_CLOSE
IOCTL for sending a CLOSE command.
NTSTATUS cbmiec_iec_set(IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
Set a specific line on the IEC bus.
CBMT_BOOLEAN CBMT_GET_EOI_OUT
NTSTATUS cbmiec_pp_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
Write a byte to the X[M|A]P1541 cable.
#define OUTPUTVALUE(_ttt_)
NTSTATUS cbmiec_iec_dbg_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Value)
Write a byte to the parallel port output register.
NTSTATUS cbmiec_parallel_burst_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
@@@
NTSTATUS cbmiec_pp_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
Read a byte from the X[M|A]P1541 cable.
NTSTATUS cbmiec_parallel_burst_read(IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
@@@
CBMT_LINE CBMT_IEC_POLL_OUT