OpenCBM
Data Structures | Typedefs | Functions
arch_cbm_driver.h File Reference

Windows-specific definitions for the opencbm driver. More...

#include "config.h"

Go to the source code of this file.

Data Structures

struct  _ARCH_DEVICE_EXTENSION
 

Typedefs

typedef struct
_ARCH_DEVICE_EXTENSION 
ARCH_DEVICE_EXTENSION
 
typedef PVOID PENUMERATE
 

Functions

VOID DriverUnload (IN PDRIVER_OBJECT DriverObject)
 Unload routine of the driver. More...
 
NTSTATUS DriverCommonInit (IN PDRIVER_OBJECT Driverobject, IN PUNICODE_STRING RegistryPath)
 Perform driver initialization, common to WDM and NT4 driver. More...
 
VOID DriverCommonUninit (VOID)
 Undo what DriverCommonInit() has done. More...
 
NTSTATUS AddDeviceCommonInit (IN PDEVICE_OBJECT Fdo, IN PUNICODE_STRING DeviceName, IN PCWSTR ParallelPortName)
 Initialize device object, common to WDM and NT4 driver. More...
 
NTSTATUS cbm_install (IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
 Complete driver installation. More...
 
NTSTATUS cbm_lock (IN PDEVICE_EXTENSION Pdx)
 Lock the parallel port for the driver. More...
 
NTSTATUS cbm_unlock (IN PDEVICE_EXTENSION Pdx)
 Unlock the parallel port for the driver. More...
 
NTSTATUS cbm_lock_parport (IN PDEVICE_EXTENSION Pdx)
 Lock the parallel port for the driver. More...
 
NTSTATUS cbm_unlock_parport (IN PDEVICE_EXTENSION Pdx)
 Unlock the parallel port for the driver. More...
 
NTSTATUS cbm_dbg_readbuffer (IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer, IN OUT PULONG ReturnLength)
 Give the debug buffer contents to the installer. More...
 
VOID cbm_init_registry (IN PUNICODE_STRING RegistryPath, IN PDEVICE_EXTENSION Pdx)
 Initialize from registry. More...
 
VOID cbm_initialize_cable_deferred (IN PDEVICE_EXTENSION Pdx)
 Initialize the cable. More...
 
NTSTATUS cbm_startio (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Execute an IRP. More...
 
NTSTATUS cbm_createopenclose (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Services IRPs containing the IRP_MJ_CREATE or IRP_MJ_CLOSE I/O function code. More...
 
NTSTATUS cbm_readwrite (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Services reads from or writes to the driver. More...
 
NTSTATUS cbm_execute_readwrite (IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
 Executes reads from or writes to the driver. More...
 
NTSTATUS cbm_execute_createopen (IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
 Execute IRPs containing the IRP_MJ_CREATEOPEN I/O function code. More...
 
NTSTATUS cbm_cleanup (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Services IRPs containing the IRP_MJ_CLEANUP I/O function code. More...
 
NTSTATUS cbm_execute_close (IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
 Execute IRPs containing the IRP_MJ_CLOSE I/O function code. More...
 
NTSTATUS cbm_devicecontrol (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Services IOCTLs. More...
 
NTSTATUS cbm_execute_devicecontrol (IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
 Executes IOCTLs. More...
 
BOOLEAN cbm_isr (IN PKINTERRUPT Interrupt, IN PVOID Pdx)
 Interrupt Service Routine (ISR) More...
 
VOID cbm_thread (IN PVOID Context)
 The thread function. More...
 
NTSTATUS cbm_start_thread (IN PDEVICE_EXTENSION Pdx)
 Start the worker thread. More...
 
VOID cbm_stop_thread (IN PDEVICE_EXTENSION Pdx)
 Stop the worker thread. More...
 
NTSTATUS ParPortEnumerateOpen (PENUMERATE *EnumStruct)
 Start enumeration of the parallel port drivers. More...
 
NTSTATUS ParPortEnumerate (PENUMERATE EnumStruct, PCWSTR *DriverName)
 Get next enumerated parallel port driver. More...
 
VOID ParPortEnumerateClose (PENUMERATE EnumStruct)
 Stop enumeration of the parallel port drivers. More...
 
NTSTATUS ParPortInit (PUNICODE_STRING ParallelPortName, PDEVICE_EXTENSION Pdx)
 Initialize the knowledge on a parallel port. More...
 
NTSTATUS ParPortDeinit (PDEVICE_EXTENSION Pdx)
 Undoes anything ParPortInit has done. More...
 
NTSTATUS ParPortAllocate (PDEVICE_EXTENSION Pdx)
 Allocate a parallel port for using it. More...
 
NTSTATUS ParPortFree (PDEVICE_EXTENSION Pdx)
 Free a parallel port after using it. More...
 
NTSTATUS ParPortSetMode (PDEVICE_EXTENSION Pdx)
 Set the operational mode of the parallel port. More...
 
NTSTATUS ParPortUnsetMode (PDEVICE_EXTENSION Pdx)
 Unset the operational mode of the parallel port. More...
 
NTSTATUS ParPortSetModeWdm (PDEVICE_EXTENSION Pdx)
 Set the operational mode of the parallel port, WDM Version. More...
 
NTSTATUS ParPortUnsetModeWdm (PDEVICE_EXTENSION Pdx)
 Unset the operational mode of the parallel port, WDM Version. More...
 
NTSTATUS ParPortAllocInterrupt (PDEVICE_EXTENSION Pdx, PKSERVICE_ROUTINE Isr)
 Allocate an interrupt routine for a parallel port. More...
 
NTSTATUS ParPortFreeInterrupt (PDEVICE_EXTENSION Pdx)
 Free an interrupt routine for a parallel port after using it. More...
 
NTSTATUS ParPortAllowInterruptIoctl (PDEVICE_EXTENSION Pdx)
 Set registry key such that we can get the interrupt of a parallel port. More...
 
NTSTATUS cbm_registry_open_for_read (OUT PHANDLE HandleKey, IN PUNICODE_STRING Path)
 Open a registry path for reading. More...
 
NTSTATUS cbm_registry_open_hardwarekey (OUT PHANDLE HandleKey, OUT PDEVICE_OBJECT *Pdo, IN PDEVICE_EXTENSION Pdx)
 Open the hardware key for another driver. More...
 
NTSTATUS cbm_registry_close (IN HANDLE HandleKey)
 Close a registry key. More...
 
NTSTATUS cbm_registry_close_hardwarekey (IN HANDLE HandleKey, IN PDEVICE_OBJECT Pdo)
 Close a hardware registry key. More...
 
NTSTATUS cbm_registry_read_ulong (IN HANDLE HandleKey, IN PCWSTR KeyName, OUT PULONG Value)
 Read a ULONG value out of a registry key. More...
 
NTSTATUS cbm_registry_write_ulong (IN HANDLE HandleKey, IN PCWSTR KeyName, IN ULONG Value)
 Write a ULONG value out of a registry key. More...
 
NTSTATUS CbmOpenDeviceRegistryKey (IN PDEVICE_OBJECT a, IN ULONG b, IN ACCESS_MASK c, OUT PHANDLE d)
 Stub for a function. More...
 
ULONG CbmGetCurrentProcessorNumber (VOID)
 Wrapper for KeGetCurrentProcessorNumber() More...
 
ULONG CbmGetNumberProcessors (VOID)
 Get the number of processors in the system. More...
 
VOID CLI (VOID)
 Stop interrupts with CLI assembler command. More...
 
VOID STI (VOID)
 Restart interrupts with STI assembler command. More...
 

Detailed Description

Windows-specific definitions for the opencbm driver.



Author
Spiro Trikaliotis

Definition in file arch_cbm_driver.h.

Typedef Documentation

The device extension for the device

typedef struct ENUMERATE_WDM * PENUMERATE

opaque enumeration structure.

Definition at line 209 of file arch_cbm_driver.h.

Function Documentation

NTSTATUS AddDeviceCommonInit ( IN PDEVICE_OBJECT  Fdo,
IN PUNICODE_STRING  DeviceName,
IN PCWSTR  ParallelPortName 
)

Initialize device object, common to WDM and NT4 driver.

This function initializes the device object, as done in AddDevice() of a WDM driver, or in DriverEntry() for an NT4 driver.

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver.
DeviceNamePointer to the name of the device.
ParallelPortNamePointer to the name of the parallel port driver which this device will use.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

This function performs the following steps:
1. Initialize the Pdx
2. Initialize the Queue inside of the Pdx
3. Initialize the operating mode of the Fdo (Buffered, Direct, Neither)
4. Get the information from the parallel port
5. Start the Worker Thread
6. Log either success or failure

Definition at line 402 of file libcommon/init.c.

References cbm_initialize_cable_deferred(), cbm_start_thread(), cbm_startio(), CbmGetNumberProcessors(), DBG_ERROR, DBG_PREFIX, FUNC_ENTER, LogErrorOnly, LogErrorString, ParPortInit(), and QueueInit().

Referenced by AddDevice().

NTSTATUS cbm_cleanup ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Services IRPs containing the IRP_MJ_CLEANUP I/O function code.

Services IRPs containing the IRP_MJ_CREATE I/O function code.

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

The driver's DriverEntry routine has stored this routine's address in DriverObject->MajorFunction[IRP_MJ_CLEANUP].

Definition at line 44 of file cleanup.c.

References FUNC_ENTER, QueueCleanup(), and QueueCompleteIrp().

Referenced by DriverCommonInit().

NTSTATUS cbm_createopenclose ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Services IRPs containing the IRP_MJ_CREATE or IRP_MJ_CLOSE I/O function code.

Services IRPs containing the IRP_MJ_CREATE or IRP_MJ_CLOSE I/O function code.

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

The driver's DriverEntry routine has stored this routine's address in DriverObject->MajorFunction[IRP_MJ_CREATE] and DriverObject->MajorFunction[IRP_MJ_CLOSE].

Generally, all Dispatch routines execute in an arbitrary thread context at IRQL PASSIVE_LEVEL, but there are exceptions.

Definition at line 47 of file libcommon/openclose.c.

References DBG_ERROR, DBG_IRPPATH_COMPLETE, DBG_IRPPATH_PROCESS, DBG_PREFIX, FUNC_ENTER, PERF_EVENT_CLOSE_QUEUE, PERF_EVENT_OPEN_QUEUE, QueueCompleteIrp(), and QueueStartPacket().

Referenced by DriverCommonInit().

NTSTATUS cbm_dbg_readbuffer ( IN PDEVICE_EXTENSION  Pdx,
OUT PCHAR  ReturnBuffer,
IN OUT PULONG  ReturnLength 
)

Give the debug buffer contents to the installer.

This function is used to get the contents of the debug buffer for the use of the installer.

Parameters
PdxPointer to the device extension.
ReturnBufferPointer to a buffer which will contain the result.
ReturnLengthPointer to a ULONG which contains the length of the ReturnBuffer on entry, and which will contain the length of the written ReturnBuffer on exit.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

This function copies the last ReturnLength bytes into the buffer.

Todo:

Definition at line 1416 of file sys/libcommon/debug.c.

References FUNC_ENTER, and min.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbm_devicecontrol ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Services IOCTLs.

Services IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values:
STATUS_SUCCESS - Success.
STATUS_PENDING - Request pending.
STATUS_BUFFER_TOO_SMALL - Buffer too small.
STATUS_INVALID_PARAMETER - Invalid io control request.

The driver's DriverEntry routine stored this routine's address in DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL].

Generally, all Dispatch routines execute in an arbitrary thread context at IRQL PASSIVE_LEVEL, but there are exceptions.

Definition at line 115 of file ioctl.c.

References CBMCTRL_CLEAR_EOI, CBMCTRL_CLOSE, CBMCTRL_GET_EOI, CBMCTRL_I_INSTALL, CBMCTRL_I_READDBG, CBMCTRL_IEC_DBG_READ, CBMCTRL_IEC_DBG_WRITE, CBMCTRL_IEC_POLL, CBMCTRL_IEC_RELEASE, CBMCTRL_IEC_SET, CBMCTRL_IEC_SETRELEASE, CBMCTRL_IEC_WAIT, CBMCTRL_LISTEN, CBMCTRL_OPEN, CBMCTRL_PARBURST_READ, CBMCTRL_PARBURST_READ_TRACK, CBMCTRL_PARBURST_READ_TRACK_VAR, CBMCTRL_PARBURST_WRITE, CBMCTRL_PARBURST_WRITE_TRACK, CBMCTRL_PARPORT_LOCK, CBMCTRL_PARPORT_UNLOCK, CBMCTRL_PP_READ, CBMCTRL_PP_WRITE, CBMCTRL_RESET, CBMCTRL_TALK, CBMCTRL_TEST_IRQ, CBMCTRL_UNLISTEN, CBMCTRL_UNTALK, CBMCTRL_UPDATE, DBG_ERROR, DBG_IRPPATH_PROCESS, DBG_PREFIX, FUNC_ENTER, PERF_EVENT_IOCTL_QUEUE, QueueCompleteIrp(), and QueueStartPacket().

Referenced by DriverCommonInit().

NTSTATUS cbm_execute_close ( IN PDEVICE_EXTENSION  Pdx,
IN PIRP  Irp 
)

Execute IRPs containing the IRP_MJ_CLOSE I/O function code.

Executes IRPs containing the IRP_MJ_CLOSE I/O function code.

Parameters
PdxPointer to a DEVICE_EXTENSION structure.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 180 of file libcommon/openclose.c.

References cbm_unlock_parport(), cbmiec_release_bus(), DBG_ASSERT, DBG_IRPPATH_COMPLETE, DBG_IRPPATH_PROCESS, FUNC_ENTER, PERF_EVENT_CLOSE_EXECUTE, and QueueCompleteIrp().

Referenced by cbm_startio().

NTSTATUS cbm_execute_createopen ( IN PDEVICE_EXTENSION  Pdx,
IN PIRP  Irp 
)

Execute IRPs containing the IRP_MJ_CREATEOPEN I/O function code.

Executes IRPs containing the IRP_MJ_CREATEOPEN I/O function code.

Parameters
PdxPointer to a DEVICE_EXTENSION structure.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 117 of file libcommon/openclose.c.

References cbm_lock_parport(), cbm_unlock_parport(), cbmiec_is_cable_state_wrong(), cbmiec_reset(), DBG_ASSERT, DBG_IRPPATH_COMPLETE, DBG_IRPPATH_EXECUTE, DBG_PREFIX, DBG_PRINT, FUNC_ENTER, PERF_EVENT_OPEN_EXECUTE, and QueueCompleteIrp().

Referenced by cbm_startio().

NTSTATUS cbm_execute_devicecontrol ( IN PDEVICE_EXTENSION  Pdx,
IN PIRP  Irp 
)

Executes IOCTLs.

Executes IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

Parameters
PdxPointer to the DEVICE_EXTENSION structure.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values:
STATUS_SUCCESS - Success.
STATUS_BUFFER_TOO_SMALL - Buffer too small.

This function does not perform any validity checks on the input and output buffer! This should already been done in cbm_devicecontrol.

Definition at line 363 of file ioctl.c.

References cbm_dbg_readbuffer(), cbm_init_registry(), cbm_install(), cbm_lock(), cbm_lock_parport(), cbm_unlock(), CBMCTRL_CLEAR_EOI, CBMCTRL_CLOSE, CBMCTRL_GET_EOI, CBMCTRL_I_INSTALL, CBMCTRL_I_READDBG, CBMCTRL_IEC_DBG_READ, CBMCTRL_IEC_DBG_WRITE, CBMCTRL_IEC_POLL, CBMCTRL_IEC_RELEASE, CBMCTRL_IEC_SET, CBMCTRL_IEC_SETRELEASE, CBMCTRL_IEC_WAIT, CBMCTRL_LISTEN, CBMCTRL_OPEN, CBMCTRL_PARBURST_READ, CBMCTRL_PARBURST_READ_TRACK, CBMCTRL_PARBURST_READ_TRACK_VAR, CBMCTRL_PARBURST_WRITE, CBMCTRL_PARBURST_WRITE_TRACK, CBMCTRL_PARPORT_LOCK, CBMCTRL_PARPORT_UNLOCK, CBMCTRL_PP_READ, CBMCTRL_PP_WRITE, CBMCTRL_RESET, CBMCTRL_TALK, CBMCTRL_TEST_IRQ, CBMCTRL_UNLISTEN, CBMCTRL_UNTALK, CBMCTRL_UPDATE, cbmiec_clear_eoi(), cbmiec_close(), cbmiec_get_eoi(), cbmiec_iec_dbg_read(), cbmiec_iec_dbg_write(), cbmiec_iec_poll(), cbmiec_iec_release(), cbmiec_iec_set(), cbmiec_iec_setrelease(), cbmiec_iec_wait(), cbmiec_listen(), cbmiec_open(), cbmiec_parallel_burst_read(), cbmiec_parallel_burst_read_track(), cbmiec_parallel_burst_read_track_var(), cbmiec_parallel_burst_write(), cbmiec_pp_read(), cbmiec_pp_write(), cbmiec_reset(), cbmiec_talk(), cbmiec_test_irq(), cbmiec_unlisten(), cbmiec_untalk(), DBG_ASSERT, DBG_ERROR, DBG_IRPPATH_COMPLETE, DBG_IRPPATH_EXECUTE, DBG_PREFIX, FUNC_ENTER, INPUTVALUE, OUTPUTVALUE, PERF_EVENT_IOCTL_EXECUTE, and QueueCompleteIrp().

Referenced by cbm_startio().

NTSTATUS cbm_execute_readwrite ( IN PDEVICE_EXTENSION  Pdx,
IN PIRP  Irp 
)

Executes reads from or writes to the driver.

Services reads from or writes to the driver

Parameters
PdxPointer to the DEVICE_EXTENSION structure.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

This function does not perform any validity checks on the input and output buffer! This should already been done in cbm_readwrite.

Todo:
Remove this, is this does not make sense.

Definition at line 178 of file readwrite.c.

References cbmiec_raw_read(), cbmiec_raw_write(), DBG_ASSERT, DBG_ERROR, DBG_IRPPATH_EXECUTE, DBG_PREFIX, FUNC_ENTER, PERF_EVENT_READ_EXECUTE, PERF_EVENT_WRITE_EXECUTE, and QueueCompleteIrp().

Referenced by cbm_startio().

VOID cbm_init_registry ( IN PUNICODE_STRING  RegistryPath,
IN PDEVICE_EXTENSION  Pdx 
)

Initialize from registry.

This function initializes some driver settings from the appropriate registry keys.

Parameters
RegistryPathPointer to a UNICODE_STRING containing the name of the registry path from which to get the information. If this is NULL, this function uses the same registry path that was given the last time this function was called.
PdxPointer to the device extension of the device to be updated.

The RegistryPath parameter can be NULL, but this is only allowed on a second or subsequent call.

Pdx can be NULL, too. If it is NULL, no device-specific data is read at all.

If RegistryPath is not NULL, some memory is allocated. This has to be freed by calling DriverCommonUninit().

Definition at line 55 of file libcommon/init.c.

References cbm_registry_close(), cbm_registry_open_for_read(), cbm_registry_read_ulong(), cbmiec_global_init(), cbmiec_set_cabletype(), DBG_ASSERT, DbgFlags, FUNC_ENTER, FUNC_LEAVE, and MTAG_SERVKEY.

Referenced by AddDevice(), cbm_execute_devicecontrol(), cbm_lock_parport(), and DriverCommonInit().

VOID cbm_initialize_cable_deferred ( IN PDEVICE_EXTENSION  Pdx)

Initialize the cable.

This function initializes the cable. For this, it makes sure the initialization is started asynchronously.

Parameters
PdxPointer to the DEVICE_EXTENSION (unused).

Definition at line 174 of file libcommon/init.c.

References FUNC_ENTER, and FUNC_LEAVE.

Referenced by AddDeviceCommonInit().

NTSTATUS cbm_install ( IN PDEVICE_EXTENSION  Pdx,
OUT PCBMT_I_INSTALL_OUT  ReturnBuffer,
IN OUT PULONG  ReturnLength 
)

Complete driver installation.

This function performs anything that is needed for completing the driver installation.

Parameters
PdxPointer to the device extension.
ReturnBufferPointer to a buffer which will contain the result.
ReturnLengthPointer to a ULONG which contains the length of the ReturnBuffer on entry, and which will contain the length of the written ReturnBuffer on exit.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

If ReturnLength is smaller then the length of CBMT_I_INSTALL_OUT, then only the the first settings are copied there. This way, a caller can get information even if newer versions have more informations to give.

Definition at line 51 of file sys/libcommon/install.c.

References CBM_I_DRIVER_INSTALL_0M_NO_INTERRUPT, CBMT_I_INSTALL_OUT_MAKE_VERSION, CBMT_I_INSTALL_OUT_MAKE_VERSION_EX, CBMT_I_INSTALL_OUT::DriverVersion, CBMT_I_INSTALL_OUT::DriverVersionEx, CBMT_I_INSTALL_OUT::ErrorFlags, FUNC_ENTER, and ParPortAllowInterruptIoctl().

Referenced by cbm_execute_devicecontrol().

BOOLEAN cbm_isr ( IN PKINTERRUPT  Interrupt,
IN PVOID  Pdx 
)

Interrupt Service Routine (ISR)

This is the Interrupt Service Routine for the parallel port.

Parameters
InterruptPointer to the interrupt object.
PdxThe device extension
Returns
If we are responsible for this interrupt, we return TRUE. If not, we return FALSE and let Windows try other ISRs (if there are any).

Definition at line 38 of file isr.c.

References cbmiec_interrupt(), and DbgFlags.

Referenced by cbm_lock_parport().

NTSTATUS cbm_lock ( IN PDEVICE_EXTENSION  Pdx)

Lock the parallel port for the driver.

This function locks the driver onto the parallel port. This way, no other program or driver can allocate the parallel port and interfere with the communication.

Parameters
PdxPointer to the device extension.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Remarks
A call to cbm_lock() is undone with a call to cbm_unlock().

Note that it is not necessary to call this function (or cbm_unlock()) when all communication is done with the handle to opencbm open (that is, between cbm_driver_open() and cbm_driver_close(). You only need this function to pin the driver to the port even when cbm_driver_close() is to be executed (for example, because the program terminates).

Definition at line 179 of file lockunlock.c.

References DBG_PREFIX, DBG_PRINT, and FUNC_ENTER.

NTSTATUS cbm_lock_parport ( IN PDEVICE_EXTENSION  Pdx)

Lock the parallel port for the driver.

This function locks the driver onto the parallel port, so we can use the port afterwards.

Parameters
PdxPointer to the device extension.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Todo:
As we will try to cope without interrupt, do not handle it as an open failure if we do not succeed!

Definition at line 39 of file lockunlock.c.

References cbm_init_registry(), cbm_isr(), cbmiec_init(), cbmiec_release_bus(), DBG_ASSERT, DBG_PREFIX, DBG_PRINT, FUNC_ENTER, ParPortAllocate(), ParPortAllocInterrupt(), ParPortFree(), ParPortFreeInterrupt(), ParPortSetMode(), and ParPortUnsetMode().

Referenced by cbm_execute_createopen(), and cbm_execute_devicecontrol().

NTSTATUS cbm_readwrite ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Services reads from or writes to the driver.

Services reads from or writes to the driver

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

The driver's DriverEntry routine stored this routine's address in DriverObject->MajorFunction[IRP_MJ_READ] and DriverObject->MajorFunction[IRP_MJ_WRITE].

Generally, all Dispatch routines execute in an arbitrary thread context at IRQL PASSIVE_LEVEL, but there are exceptions.

Definition at line 84 of file readwrite.c.

References DBG_ASSERT, DBG_IRPPATH_PROCESS, FUNC_ENTER, PERF_EVENT_READ_QUEUE, PERF_EVENT_WRITE_QUEUE, QueueCompleteIrp(), and QueueStartPacket().

Referenced by DriverCommonInit().

NTSTATUS cbm_registry_close ( IN HANDLE  HandleKey)

Close a registry key.

This function closes a registry key.

Parameters
HandleKeyThe HANDLE of the registry path.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

If the registry key was obtained with a call to cbm_registry_open_hardwarekey(), you must not use this function, but use cbm_registry_close_hardwarekey() instead.

Definition at line 230 of file util-reg.c.

References FUNC_ENTER.

Referenced by cbm_init_registry(), and cbm_registry_close_hardwarekey().

NTSTATUS cbm_registry_close_hardwarekey ( IN HANDLE  HandleKey,
IN PDEVICE_OBJECT  Pdo 
)

Close a hardware registry key.

This function closes a registry key pointing to a hardware registry key.

Parameters
HandleKeyThe HANDLE of the registry path.
PdoPointer to the DEVICE_OBJECT for which we found the hardware key.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

Definition at line 260 of file util-reg.c.

References cbm_registry_close(), and FUNC_ENTER.

Referenced by ParPortAllowInterruptIoctl().

NTSTATUS cbm_registry_open_for_read ( OUT PHANDLE  HandleKey,
IN PUNICODE_STRING  Path 
)

Open a registry path for reading.

This function opens a registry key ("path"). This way, its entries can be read afterwards.

Parameters
HandleKeyPointer to a HANDLE which will contain the handle to the registry key ("path") on exit
PathPointer to a UNICODE_STRING which points to the registry key to be opened.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

A call to this function must be balanced with a call to cbm_registry_close().

Definition at line 43 of file util-reg.c.

References DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_init_registry().

NTSTATUS cbm_registry_open_hardwarekey ( OUT PHANDLE  HandleKey,
OUT PDEVICE_OBJECT *  Pdo,
IN PDEVICE_EXTENSION  Pdx 
)

Open the hardware key for another driver.

This function opens a the "hardware" registry key for the parallel port driver.

Parameters
HandleKeyPointer to a HANDLE which will contain the handle to the registry key ("path") on exit
PdoPointer to the DEVICE_OBJECT for which we found the hardware key.
PdxThe PDX of the driver which is calling this function
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

A call to this function must be balanced with a call to cbm_registry_close_hardwarekey().

Thanks to Doron Holan [MS] for pointing out how to do it (MsgId:O6weQ.nosp@m.L8qE.nosp@m.HA.34.nosp@m.28@T.nosp@m.K2MSF.nosp@m.TNGP.nosp@m.11.ph.nosp@m.x.gb.nosp@m.l on microsoft.public.development.device.drivers, http://groups.google.com/groups?selm=O6weQL8qEHA.3428%40TK2MSFTNGP11.phx.gbl

Definition at line 95 of file util-reg.c.

References CbmOpenDeviceRegistryKey(), DBG_ASSERT, and FUNC_ENTER.

Referenced by ParPortAllowInterruptIoctl().

NTSTATUS cbm_registry_read_ulong ( IN HANDLE  HandleKey,
IN PCWSTR  KeyName,
OUT PULONG  Value 
)

Read a ULONG value out of a registry key.

This function reads a ULONG value out of the registry.

Parameters
HandleKeyThe HANDLE of the registry path.
KeyNameA null-terminated wide char string which contains the name of the value to be read.
ValuePointer to a memory location which will hold the return value.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

If the value cannot be read, the return value in *Value will not be changed.

Definition at line 299 of file util-reg.c.

References DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_init_registry(), and ParPortAllowInterruptIoctl().

NTSTATUS cbm_registry_write_ulong ( IN HANDLE  HandleKey,
IN PCWSTR  KeyName,
IN ULONG  Value 
)

Write a ULONG value out of a registry key.

This function writes a ULONG value to the registry.

Parameters
HandleKeyThe HANDLE of the registry path.
KeyNameA null-terminated wide char string which contains the name of the value to be read.
ValueThe value to be written to that memory entry.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

Definition at line 356 of file util-reg.c.

References DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by ParPortAllowInterruptIoctl().

NTSTATUS cbm_start_thread ( IN PDEVICE_EXTENSION  Pdx)

Start the worker thread.

This function start the worker thread.

Parameters
PdxPointer to a DEVICE_EXTENSION structure.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.
Todo:
Replace Pdx->QuitThread with a event for quitting

Definition at line 34 of file thread.c.

References cbm_thread(), DBG_ASSERT, DBG_ERROR, DBG_PREFIX, FUNC_ENTER, LogErrorString, and PERF_EVENT_THREAD_START_SCHED.

Referenced by AddDeviceCommonInit().

NTSTATUS cbm_startio ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Execute an IRP.

This function executes an IRP. Normally, it is called from as StartIo() routine from the QUEUE, but it can be called directly (for example, if FastStart is selected).

Parameters
FdoPointer to the DEVICE_OBJECT of the FDO.
IrpPointer to the IRP to be executed.
Returns
If everything works as expected, this function returns STATUS_SUCCESS. If not, it returns an appropriate error value.

Definition at line 39 of file startio.c.

References cbm_execute_close(), cbm_execute_createopen(), cbm_execute_devicecontrol(), cbm_execute_readwrite(), DBG_ASSERT, DBG_ERROR, DBG_PREFIX, FUNC_ENTER, and PERF_EVENT_STARTIO.

Referenced by AddDeviceCommonInit().

VOID cbm_stop_thread ( IN PDEVICE_EXTENSION  Pdx)

Stop the worker thread.

This function stops the worker thread.

Parameters
PdxPointer to a DEVICE_EXTENSION structure.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.

Definition at line 117 of file thread.c.

References DBG_ASSERT, FUNC_ENTER, FUNC_LEAVE, PERF_EVENT_THREAD_STOP_SCHED, and QueueSignal().

Referenced by DriverUnload().

VOID cbm_thread ( IN PVOID  Context)

The thread function.

This function is the function of the thread itself. It polls the QUEUE and executed the IRPs which are on it.

Parameters
ContextPointer to the thread context. This is a PDX in reality.

Definition at line 165 of file thread.c.

References FUNC_ENTER, FUNC_LEAVE, PERF_EVENT_THREAD_POLL, PERF_EVENT_THREAD_START_EXEC, PERF_EVENT_THREAD_STOP_EXEC, and QueuePoll().

Referenced by cbm_start_thread().

NTSTATUS cbm_unlock ( IN PDEVICE_EXTENSION  Pdx)

Unlock the parallel port for the driver.

This function unlocks the driver from the parallel port. This way, other programs and drivers can allocate the parallel port and do their own communication with whatever device they use.

Parameters
PdxPointer to the device extension.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Remarks
Look at cbm_lock() for an explanation of this function.

Definition at line 208 of file lockunlock.c.

References DBG_PREFIX, DBG_PRINT, and FUNC_ENTER.

NTSTATUS cbm_unlock_parport ( IN PDEVICE_EXTENSION  Pdx)

Unlock the parallel port for the driver.

This function unlocks the driver from the parallel port after the port has been used.

Parameters
PdxPointer to the device extension.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 128 of file lockunlock.c.

References cbmiec_release_bus(), DBG_ASSERT, DBG_PREFIX, DBG_PRINT, FUNC_ENTER, ParPortFree(), ParPortFreeInterrupt(), and ParPortUnsetMode().

Referenced by cbm_execute_close(), cbm_execute_createopen(), and DriverUnload().

ULONG CbmGetCurrentProcessorNumber ( VOID  )

Wrapper for KeGetCurrentProcessorNumber()

See KeGetCurrentProcessorNumber()

This function is needed as KeGetCurrentProcessorNumber() is only defined in NTDDK.H, not in WDM.H. Anyway, for debugging purposes, we need to access it from anywhere..

Definition at line 31 of file processor.c.

ULONG CbmGetNumberProcessors ( VOID  )

Get the number of processors in the system.

This function returns the count of processors available in the current system.

Returns
The number of processors in the system
Remarks
This function is necessary to account between differences between the W2K API and later APIs. Additionally, on Windows 95/98/Me, there is no variable available that returns this info. On the other hand, on Win 95/98/Me, there is no chance for more than one processor, as these systems do not support more than one.

Definition at line 57 of file processor.c.

Referenced by AddDeviceCommonInit().

NTSTATUS CbmOpenDeviceRegistryKey ( IN PDEVICE_OBJECT  a,
IN ULONG  b,
IN ACCESS_MASK  c,
OUT PHANDLE  d 
)

Stub for a function.

This function is not available on NT4, and it is not needed. Because of this, we define it here for cbm4nt.sys, so that the driver successfully loads

This function is not available on NT4, and it is not needed there, but it is needed for WDM. Because of this, we define it here for cbm4wdm.sys, so that the driver works in either case.

Definition at line 303 of file nt4/PortEnum.c.

References DBG_ASSERT, and FUNC_ENTER.

Referenced by cbm_registry_open_hardwarekey().

VOID CLI ( VOID  )

Stop interrupts with CLI assembler command.

This function stops interrupts on the current CPU by executing a CLI assembler command.

Definition at line 28 of file amd64/clisti.c.

Referenced by cbmiec_block_irq().

NTSTATUS DriverCommonInit ( IN PDRIVER_OBJECT  Driverobject,
IN PUNICODE_STRING  RegistryPath 
)

Perform driver initialization, common to WDM and NT4 driver.

This function is called from the DriverEntry() of either the WDM or the NT4 driver.

Parameters
DriverobjectPointer to the DRIVER_OBJECT structure given to DriverEntry().
RegistryPathPointer to a UNICODE_STRING containing the name of the registry path from which to get the information.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 315 of file libcommon/init.c.

References cbm_cleanup(), cbm_createopenclose(), cbm_devicecontrol(), cbm_init_registry(), cbm_readwrite(), DriverUnload(), FUNC_ENTER, and PERF_INIT.

Referenced by DriverEntry().

VOID DriverCommonUninit ( VOID  )

Undo what DriverCommonInit() has done.

This function is called from the DriverUnload() of either the WDM or the NT4 driver.

This function frees memory allocated by cbm_init_registry().

Definition at line 349 of file libcommon/init.c.

References DBGDO, FUNC_ENTER, FUNC_LEAVE, and PERF_SAVE.

Referenced by DriverUnload().

VOID DriverUnload ( IN PDRIVER_OBJECT  DriverObject)

Unload routine of the driver.

DriverUnload performs any operations that are necessary before the system unloads the driver.

Parameters
DriverObjectCaller-supplied pointer to a DRIVER_OBJECT structure. This is the driver's driver object.

A driver's Unload routine executes in a system thread context at IRQL PASSIVE_LEVEL. The driver's DriverEntry routine must store the Unload routine's address in DriverObject->DriverUnload. (If no routine is supplied, this pointer must be NULL.)

Definition at line 178 of file nt4/LoadUnload.c.

References cbm_stop_thread(), cbm_unlock_parport(), DBG_ASSERT, DbgFreeMemoryBuffer(), DriverCommonUninit(), FUNC_ENTER, FUNC_LEAVE, and ParPortDeinit().

Referenced by DriverCommonInit().

NTSTATUS ParPortAllocate ( PDEVICE_EXTENSION  Pdx)

Allocate a parallel port for using it.

This function allocates a parallel port, preventing other drivers from accessing it.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function has to be balanced with a corresponding ParPortFree() This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 157 of file PortAccess.c.

References DBG_ASSERT, and FUNC_ENTER.

Referenced by cbm_lock_parport().

NTSTATUS ParPortAllocInterrupt ( PDEVICE_EXTENSION  Pdx,
PKSERVICE_ROUTINE  Isr 
)

Allocate an interrupt routine for a parallel port.

This function allocates an interrupt service routine for a parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.
IsrPointer to the interrupt service routine (ISR) which the caller wants to be installed.

This function has to be balanced with a corresponding ParPortFreeInterrupt()

The parallel port has to be already allocated!

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 628 of file PortAccess.c.

References DBG_ASSERT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and LogErrorOnly.

Referenced by cbm_lock_parport().

NTSTATUS ParPortAllowInterruptIoctl ( PDEVICE_EXTENSION  Pdx)

Set registry key such that we can get the interrupt of a parallel port.

This function sets some specific registry key which allows us to allocate an interrupt service routine for a parallel port. Without this key, allocating the interrupt is forbidden for Win 2000, XP, and above.

This is not true for NT4.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function must be run at IRQL == PASSIVE_LEVEL.

Warning
This function cannot be used on NT4! In fact, it is unnecessary there.

Definition at line 729 of file PortAccess.c.

References cbm_registry_close_hardwarekey(), cbm_registry_open_hardwarekey(), cbm_registry_read_ulong(), cbm_registry_write_ulong(), DBG_ASSERT, and FUNC_ENTER.

Referenced by cbm_install().

NTSTATUS ParPortDeinit ( PDEVICE_EXTENSION  Pdx)

Undoes anything ParPortInit has done.

This function undoes anything ParPortInit() has done.

Parameters
PdxDevice extension which will be initialized with the needed knowledge on the parallel port.

This function should be called as part of the unloading process of the driver

One of the purposes of this function is to allow the parallel port driver to be unloaded from memory (via calling ObDereferenceObject()).

This function must be run at IRQL <= DISPATCH_LEVEL.

Definition at line 339 of file PortAccess.c.

References FUNC_ENTER.

Referenced by DriverUnload().

NTSTATUS ParPortEnumerate ( PENUMERATE  EnumStruct,
PCWSTR *  DriverName 
)

Get next enumerated parallel port driver.

This function starts the enumeration process of the parallel port drivers

Parameters
EnumStructPointer to a ENUMERATE structure. This is internal storage for these functions.
DriverName;Pointer to a storage area which will contain the next driver implementing this interface.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

For enumerating, a caller has to do the following:

Definition at line 196 of file nt4/PortEnum.c.

References DBG_ASSERT, and FUNC_ENTER.

Referenced by DriverEntry().

VOID ParPortEnumerateClose ( PENUMERATE  EnumStruct)

Stop enumeration of the parallel port drivers.

This function stops the enumeration process of the parallel port drivers

Parameters
EnumStructPointer to a ENUMERATE structure, which contains the last enumerated driver

For enumerating, a caller has to do the following:

Definition at line 264 of file nt4/PortEnum.c.

References DBG_ASSERT, DBGDO, FUNC_ENTER, and FUNC_LEAVE.

Referenced by DriverEntry(), and ParPortEnumerateOpen().

NTSTATUS ParPortEnumerateOpen ( PENUMERATE EnumStruct)

Start enumeration of the parallel port drivers.

This function starts the enumeration process of the parallel port drivers

Parameters
EnumStructPointer to a pointer to hold an ENUMERATE structure. This is internal storage for these functions, and it is allocated by this function.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

For enumerating, a caller has to do the following:

Definition at line 74 of file nt4/PortEnum.c.

References DBG_PREFIX, DBG_WARN, FUNC_ENTER, MTAG_SENUMERATE, and ParPortEnumerateClose().

Referenced by DriverEntry().

NTSTATUS ParPortFree ( PDEVICE_EXTENSION  Pdx)

Free a parallel port after using it.

This function frees a previously allocated parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

If the parallel port has not been already allocated, this function just returns.

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 195 of file PortAccess.c.

References DBG_ASSERT, and FUNC_ENTER.

Referenced by cbm_lock_parport(), and cbm_unlock_parport().

NTSTATUS ParPortFreeInterrupt ( PDEVICE_EXTENSION  Pdx)

Free an interrupt routine for a parallel port after using it.

This function frees a previously allocated parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

If the parallel port interrupt has not been already allocated, this function just returns.

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 680 of file PortAccess.c.

References DBG_ASSERT, and FUNC_ENTER.

Referenced by cbm_lock_parport(), and cbm_unlock_parport().

NTSTATUS ParPortInit ( PUNICODE_STRING  ParallelPortName,
PDEVICE_EXTENSION  Pdx 
)

Initialize the knowledge on a parallel port.

This function gets some knowledge on a parallel port, and stores this info into the given DEVICE_EXTENSION.

Parameters
ParallelPortNameUNICODE_STRING which holds the name of the parallel port driver
PdxDevice extension which will be initialized with the needed knowledge on the parallel port.

This function should be called before any other parallel port function is called. Usually, it is done in the driver's AddDevice (WDM) or DriverEntry (WKM, WDM) function.

One of the purposes of this function is to make sure the parallel port driver is not unloaded from memory (via IoGetDeviceObjectPointer()).

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 253 of file PortAccess.c.

References DBG_ASSERT, DBG_PPORT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and MTAG_PPINFO.

Referenced by AddDeviceCommonInit().

NTSTATUS ParPortSetMode ( PDEVICE_EXTENSION  Pdx)

Set the operational mode of the parallel port.

This function sets the operational mode of the parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function has to be balanced with a corresponding ParPortUnsetMode()

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 532 of file PortAccessNt4.c.

References cbmiec_udelay(), FUNC_ENTER, ParPortSetModeNt4(), and ParPortSetModeWdm().

Referenced by cbm_lock_parport().

NTSTATUS ParPortSetModeWdm ( PDEVICE_EXTENSION  Pdx)

Set the operational mode of the parallel port, WDM Version.

This function sets the operational mode of the parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function has to be balanced with a corresponding ParPortUnsetModeWdm()

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 461 of file PortAccess.c.

References DBG_PPORT, DBG_PREFIX, DebugNtStatus(), FUNC_ENTER, ParPortUnsetMode(), and READ_PORT_UCHAR.

Referenced by ParPortSetMode().

NTSTATUS ParPortUnsetMode ( PDEVICE_EXTENSION  Pdx)

Unset the operational mode of the parallel port.

This function unsets the operational mode of the parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function mustn't be called without a prior call to ParPortSetMode()

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 568 of file PortAccessNt4.c.

References FUNC_ENTER, ParPortUnsetModeNt4(), and ParPortUnsetModeWdm().

Referenced by cbm_lock_parport(), cbm_unlock_parport(), and ParPortSetModeWdm().

NTSTATUS ParPortUnsetModeWdm ( PDEVICE_EXTENSION  Pdx)

Unset the operational mode of the parallel port, WDM Version.

This function unsets the operational mode of the parallel port.

Parameters
PdxPointer to a device extension which contains the DEVICE_OBJECT of the parallel port driver.

This function mustn't be called without a prior call to ParPortSetModeWdm()

This function must be run at IRQL == PASSIVE_LEVEL.

Definition at line 549 of file PortAccess.c.

References DBG_PPORT, DBG_PREFIX, DebugNtStatus(), FUNC_ENTER, and READ_PORT_UCHAR.

Referenced by ParPortUnsetMode().

VOID STI ( VOID  )

Restart interrupts with STI assembler command.

This function stops interrupts on the current CPU by executing a STI assembler command.

Definition at line 38 of file amd64/clisti.c.

Referenced by cbmiec_release_irq().