Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

lockunlock.c File Reference

Functions for locking und unlocking the driver onto the parallel port. More...

#include <wdm.h>
#include "cbm_driver.h"
#include "iec.h"
#include "version.h"

Go to the source code of this file.

Functions

NTSTATUS cbm_lock_parport (IN PDEVICE_EXTENSION Pdx)
 Lock the parallel port for the driver.
NTSTATUS cbm_unlock_parport (IN PDEVICE_EXTENSION Pdx)
 Unlock the parallel port for the driver.
NTSTATUS cbm_lock (IN PDEVICE_EXTENSION Pdx)
 Lock the parallel port for the driver.
NTSTATUS cbm_unlock (IN PDEVICE_EXTENSION Pdx)
 Unlock the parallel port for the driver.


Detailed Description

Functions for locking und unlocking the driver onto the parallel port.

**************************************************************

Author:
Spiro Trikaliotis
Version:
Id
lockunlock.c,v 1.4 2006/04/10 10:26:35 trikalio Exp


Definition in file lockunlock.c.


Function Documentation

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:
Pdx Pointer 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 174 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:
Pdx Pointer 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 40 of file lockunlock.c.

References 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_init_registry().

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:
Pdx Pointer 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 203 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:
Pdx Pointer 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 123 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(), and DriverUnload().


Generated on Sun Apr 30 18:46:11 2006 for opencbm by  doxygen 1.4.2