OpenCBM
Typedefs | Enumerations | Functions
iec.h File Reference

Definitions for the libiec library. More...

Go to the source code of this file.

Typedefs

typedef enum iec_checkdevice IEC_CHECKDEVICE
 

Enumerations

enum  iec_checkdevice { IEC_CHECKDEVICE_BUSFREE = 0, IEC_CHECKDEVICE_NODEVICE = 1, IEC_CHECKDEVICE_BUSBUSY = 2 }
 

Functions

NTSTATUS cbmiec_wait_for_drives_ready (IN PDEVICE_EXTENSION Pdx)
 Wait for the drives to become ready after a RESET. More...
 
NTSTATUS cbmiec_reset (IN PDEVICE_EXTENSION Pdx)
 Send a RESET to the IEC bus. More...
 
BOOLEAN cbmiec_send_byte (IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
 Write one byte to the IEC bus. More...
 
VOID cbmiec_wait_for_listener (IN PDEVICE_EXTENSION Pdx, IN BOOLEAN SendEoi)
 Wait until listener is ready to receive. More...
 
VOID cbmiec_release_bus (IN PDEVICE_EXTENSION Pdx)
 Release the IEC bus. More...
 
NTSTATUS cbmiec_untalk (IN PDEVICE_EXTENSION Pdx)
 Send an UNTALK over the IEC bus. More...
 
NTSTATUS cbmiec_unlisten (IN PDEVICE_EXTENSION Pdx)
 Send an UNLISTEN over the IEC bus. More...
 
NTSTATUS cbmiec_listen (IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
 Send a LISTEN over the IEC bus. More...
 
NTSTATUS cbmiec_talk (IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
 Send a TALK over the IEC bus. More...
 
NTSTATUS cbmiec_open (IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
 Open a file on the IEC bus. More...
 
NTSTATUS cbmiec_close (IN PDEVICE_EXTENSION Pdx, IN UCHAR DeviceAddress, IN UCHAR SecondaryAddress)
 Close a file on the IEC bus. More...
 
NTSTATUS cbmiec_get_eoi (IN PDEVICE_EXTENSION Pdx, OUT PBOOLEAN Result)
 Check if an EOI signal has been sent over the IEC bus. More...
 
NTSTATUS cbmiec_clear_eoi (IN PDEVICE_EXTENSION Pdx)
 Reset the EOI state. More...
 
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. More...
 
NTSTATUS cbmiec_iec_poll (IN PDEVICE_EXTENSION Pdx, OUT PUCHAR Result)
 Polls the status of the lines on the IEC bus. More...
 
NTSTATUS cbmiec_iec_set (IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
 Set a specific line on the IEC bus. More...
 
NTSTATUS cbmiec_iec_release (IN PDEVICE_EXTENSION Pdx, IN USHORT Line)
 Release a specific line on the IEC bus. More...
 
NTSTATUS cbmiec_iec_setrelease (IN PDEVICE_EXTENSION Pdx, IN USHORT Set, IN USHORT Release)
 Activate and deactive a line on the IEC serial bus. More...
 
NTSTATUS cbmiec_iec_dbg_read (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Value)
 Read a byte from the parallel port input register. More...
 
NTSTATUS cbmiec_iec_dbg_write (IN PDEVICE_EXTENSION Pdx, IN UCHAR Value)
 Write a byte to the parallel port output register. More...
 
NTSTATUS cbmiec_pp_read (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
 Read a byte from the X[M|A]P1541 cable. More...
 
NTSTATUS cbmiec_pp_write (IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
 Write a byte to the X[M|A]P1541 cable. More...
 
BOOLEAN cbmiec_interrupt (IN PDEVICE_EXTENSION Pdx)
 Interrupt handler for the IEC bus. More...
 
NTSTATUS cbmiec_cleanup (IN PDEVICE_EXTENSION Pdx)
 Cleanup the IEC bus. More...
 
NTSTATUS cbmiec_init (IN PDEVICE_EXTENSION Pdx)
 Initialize the IEC bus. More...
 
NTSTATUS cbmiec_global_init (IN PHANDLE HKey)
 Initialization for libiec which are global in nature. More...
 
NTSTATUS cbmiec_raw_write (IN PDEVICE_EXTENSION Pdx, IN const PUCHAR Buffer, IN ULONG BufferLength, OUT ULONG *Written)
 Write some bytes to the IEC bus. More...
 
NTSTATUS cbmiec_raw_read (IN PDEVICE_EXTENSION Pdx, OUT PUCHAR Buffer, IN ULONG BufferLength, OUT ULONG *Read)
 Read some bytes from the IEC bus. More...
 
VOID cbmiec_set_cabletype (IN PDEVICE_EXTENSION Pdx, IN IEC_CABLETYPE CableType)
 Set the type of the IEC cable. More...
 
NTSTATUS cbmiec_check_device (IN PDEVICE_EXTENSION Pdx, OUT IEC_CHECKDEVICE *CheckDevice)
 Fast IEC drive detection. More...
 
NTSTATUS cbmiec_parallel_burst_read (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Byte)
 @@@ More...
 
NTSTATUS cbmiec_parallel_burst_write (IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
 @@@ More...
 
NTSTATUS cbmiec_parallel_burst_read_track (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
 @@@ More...
 
NTSTATUS cbmiec_parallel_burst_read_track_var (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *Buffer, IN ULONG BufferLength)
 @@@ More...
 
NTSTATUS cbmiec_parallel_burst_write_track (IN PDEVICE_EXTENSION Pdx, IN UCHAR *Buffer, IN ULONG BufferLength)
 
NTSTATUS cbmiec_test_irq (IN PDEVICE_EXTENSION Pdx, OUT PVOID Buffer, IN ULONG BufferLength)
 Test for IRQ capabilities. More...
 
NTSTATUS cbmiec_checkcable (PDEVICE_EXTENSION Pdx)
 Determine the type of cable (XA1541/XM1541) on the IEC bus. More...
 
BOOLEAN cbmiec_is_cable_state_wrong (PDEVICE_EXTENSION Pdx)
 @@@ More...
 

Detailed Description

Definitions for the libiec library.



Author
Spiro Trikaliotis

Definition in file iec.h.

Typedef Documentation

status of the bus after a call to cbmiec_check_device()

Enumeration Type Documentation

status of the bus after a call to cbmiec_check_device()

Enumerator
IEC_CHECKDEVICE_BUSFREE 

we are free to use the bus

IEC_CHECKDEVICE_NODEVICE 

no device attached

IEC_CHECKDEVICE_BUSBUSY 

the bus is still busy

Definition at line 23 of file iec.h.

Function Documentation

NTSTATUS cbmiec_check_device ( IN PDEVICE_EXTENSION  Pdx,
OUT IEC_CHECKDEVICE CheckDevice 
)

Fast IEC drive detection.

This function has two purposes: First of all, it tries to find out if there are devices responding on the IEC bus. Secondly, it finds out if the bus is blocked by a device, for example, because the device is busy.

Parameters
PdxPointer to the device extension.
CheckDevicePointer to a IEC_CHECKDEVICE variable which will contain the status of the bus: IEC_CHECKDEVICE_NODEVICE indicates that there is no device attached, IEC_CHECKDEVICE_BUSBUSY indicates that the bus is still busy, and IEC_CHECKDEVICE_BUSFREE indicates we are free to use the bus.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 49 of file checkdevice.c.

References CBMIEC_GET, CBMIEC_RELEASE, cbmiec_schedule_timeout(), CBMIEC_SET, DBG_ASSERT, FUNC_ENTER, IEC_CHECKDEVICE_BUSBUSY, IEC_CHECKDEVICE_BUSFREE, IEC_CHECKDEVICE_NODEVICE, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_IN, PP_DATA_OUT, and PP_RESET_OUT.

Referenced by cbmiec_wait_for_drives_ready().

NTSTATUS cbmiec_checkcable ( PDEVICE_EXTENSION  Pdx)

Determine the type of cable (XA1541/XM1541) on the IEC bus.

This function tries to determine the type of cable with which the IEC bus is connected to the PC's parallel port. Afterwards, some variables in the device extension are initialized to reflect the type.

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 334 of file checkcable.c.

References CABLESTATE_TESTED, CABLESTATE_UNKNOWN, CBMIEC_GET, cbmiec_setcablestate(), DBG_ERROR, DBG_PREFIX, DBG_SUCCESS, FUNC_ENTER, LogErrorString, OUT_PORT, PP_XA_ATN_IN, PP_XA_ATN_OUT, and READ_PORT_UCHAR.

Referenced by cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_init(), and cbmiec_release_bus().

NTSTATUS cbmiec_cleanup ( IN PDEVICE_EXTENSION  Pdx)

Cleanup the IEC bus.

This function cleans the IEC bus immediately before it is released.

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 116 of file libiec/init.c.

References cbmiec_release_bus(), and FUNC_ENTER.

NTSTATUS cbmiec_clear_eoi ( IN PDEVICE_EXTENSION  Pdx)

Reset the EOI state.

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 61 of file eoi.c.

References FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_close ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Device,
IN UCHAR  Secaddr 
)

Close a file on the IEC bus.

This function opens a file on the IEC bus.

Parameters
PdxPointer to the device extension.
DeviceDevice (primary) address
SecaddrSecondary address
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 81 of file libiec/openclose.c.

References cbmiec_i_raw_write(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_get_eoi ( IN PDEVICE_EXTENSION  Pdx,
OUT PBOOLEAN  Result 
)

Check if an EOI signal has been sent over the IEC bus.

Parameters
PdxPointer to the device extension.
ResultPointer to the variable which will hold the return value. After return, it will contain 1 if there was an EOI, 0 otherwise.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 40 of file eoi.c.

References FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_global_init ( IN PHANDLE  HKey)

Initialization for libiec which are global in nature.

This function initializes libiec.

Parameters
HKeyPointer to a handle with holds a registry key. If this is NULL, no access to the registry is performed.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 251 of file libiec/init.c.

References FUNC_ENTER.

Referenced by cbm_init_registry().

NTSTATUS cbmiec_iec_dbg_read ( IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Return 
)

Read a byte from the parallel port input register.

This function reads a byte from the parallel port input register. (STATUS_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only!

Parameters
PdxPointer to the device extension.
ReturnPointer to an UCHAR where the read byte is written to.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Remarks
Do not use this function in anything but a debugging aid tool like XCDETECT!

This functions masks some bits off. The bits that are not masked off are defined in PARALLEL_STATUS_PORT_MASK_VALUES.

Definition at line 51 of file dbgread.c.

References DBG_PREFIX, DBG_PRINT, FUNC_ENTER, IN_PORT, PARALLEL_STATUS_PORT_MASK_VALUES, and READ_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_iec_dbg_write ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Value 
)

Write a byte to the parallel port output register.

This function writes a byte to the parallel port output register. (CONTROL_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only!

Parameters
PdxPointer to the device extension.
ValueThe value to set the control port to
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Remarks
Do not use this function in anything but a debugging aid tool like XCDETECT!

After this function has been called, it is NOT safe to use the parallel port driver unless you close the driver and open it again!

This functions masks some bits off. That is, the bits not in the mask are not changed at all. The bits that are not masked off are defined in PARALLEL_CONTROL_PORT_MASK_VALUES.

Definition at line 56 of file dbgwrite.c.

References DBG_PREFIX, DBG_PRINT, FUNC_ENTER, OUT_PORT, PARALLEL_CONTROL_PORT_MASK_VALUES, and WRITE_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_iec_poll ( IN PDEVICE_EXTENSION  Pdx,
OUT PUCHAR  Result 
)

Polls the status of the lines on the IEC bus.

Parameters
PdxPointer to the device extension.
ResultPointer to a variable which will hold the value of the IEC bus
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 39 of file poll.c.

References FUNC_ENTER, IEC_LINE_ATN, IEC_LINE_CLOCK, IEC_LINE_DATA, IEC_LINE_RESET, IN_PORT, PP_ATN_IN, PP_CLK_IN, PP_DATA_IN, PP_RESET_IN, and READ_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol(), and cbmiec_iec_wait().

NTSTATUS cbmiec_iec_release ( IN PDEVICE_EXTENSION  Pdx,
IN USHORT  Line 
)

Release a specific line on the IEC bus.

This function releases a specific line on the IEC bus.

Parameters
PdxPointer to the device extension.
LineWhich line has to be released (an OR between IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET)
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 42 of file release.c.

References cbmiec_iec_setrelease(), and FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_iec_set ( IN PDEVICE_EXTENSION  Pdx,
IN USHORT  Line 
)

Set a specific line on the IEC bus.

This function sets a specific line on the IEC bus.

Parameters
PdxPointer to the device extension.
LineWhich line has to be set (an OR between IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET)
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 42 of file set.c.

References cbmiec_iec_setrelease(), and FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_iec_setrelease ( IN PDEVICE_EXTENSION  Pdx,
IN USHORT  Set,
IN USHORT  Release 
)

Activate and deactive a line on the IEC serial bus.

This function activates (sets to 0V, L) and deactivates (set to 5V, H) lines on the IEC serial bus.

Parameters
PdxPointer to the device extension.
SetThe mask of which lines should be set. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET
ReleaseThe mask of which lines should be released. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.
Remarks
If a bit is specified in the Set as well as in the Release mask, the effect is undefined.

Definition at line 59 of file setrelease.c.

References CBMIEC_SET_RELEASE, DBG_ASSERT, DBG_PREFIX, FUNC_ENTER, FUNC_PARAM, IEC_LINE_ATN, IEC_LINE_CLOCK, IEC_LINE_DATA, IEC_LINE_RESET, and SET_RELEASE_LINE.

Referenced by cbm_execute_devicecontrol(), cbmiec_iec_release(), and cbmiec_iec_set().

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.

This function waits until a listener is ready.

Parameters
PdxPointer to the device extension.
LineWhich line has to be monitored (one of IEC_DATA, IEC_CLOCK, IEC_ATN)
StateType of wait
=1: Wait until that line is set
=0: Wait until that line is unset
ResultPointer to a variable which will hold the value of the IEC bus

Definition at line 45 of file wait.c.

References cbmiec_iec_poll(), cbmiec_schedule_timeout(), cbmiec_udelay(), DBG_PREFIX, FUNC_ENTER, FUNC_PARAM, IEC_LINE_ATN, IEC_LINE_CLOCK, IEC_LINE_DATA, IN_PORT, libiec_global_timeouts, PP_ATN_IN, PP_CLK_IN, PP_DATA_IN, QueueShouldCancelCurrentIrp(), READ_PORT_UCHAR, IEC_TIMEOUTS::T_8_IEC_WAIT_LONG_DELAY, and IEC_TIMEOUTS::T_8_IEC_WAIT_SHORT_DELAY.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_init ( IN PDEVICE_EXTENSION  Pdx)

Initialize the IEC bus.

This function initializes the IEC bus itself, and sets some variables in the device extension. It has to be called before any other IEC function is called.

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 199 of file libiec/init.c.

References cbmiec_checkcable(), CBMIEC_RELEASE, FUNC_ENTER, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_OUT, PP_LP_BIDIR, PP_LP_IRQ, and PP_RESET_OUT.

Referenced by cbm_lock_parport().

BOOLEAN cbmiec_interrupt ( IN PDEVICE_EXTENSION  Pdx)

Interrupt handler for the IEC bus.

This function is the interrupt handler for the IEC bus. Its only purpose is to count the number of interrupts for cbmiec_wait_for_listener().

Parameters
PdxPointer to the device extension.
Returns
TRUE if this interrupt was generated by the parallel port,
FALSE else
Bug:
this does not work. At least my parallel port card does not change bit 2 in any way!

Definition at line 40 of file interrupt.c.

References DBG_PPORT, DBG_PREFIX, FUNC_ENTER, IN_PORT, and READ_PORT_UCHAR.

Referenced by cbm_isr().

BOOLEAN cbmiec_is_cable_state_wrong ( PDEVICE_EXTENSION  Pdx)

@@@

Todo:
document
Parameters
Pdx
Returns

Definition at line 511 of file checkcable.c.

References CBMIEC_ARE_OUTPUT_LINES_CORRECT.

Referenced by cbm_execute_createopen().

NTSTATUS cbmiec_listen ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Device,
IN UCHAR  Secaddr 
)

Send a LISTEN over the IEC bus.

This function sends a listen on the IEC bus.

Parameters
PdxPointer to the device extension.
DeviceDevice (primary) address
SecaddrSecondary address
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 44 of file listen.c.

References cbmiec_i_raw_write(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_open ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Device,
IN UCHAR  Secaddr 
)

Open a file on the IEC bus.

This function opens a file on the IEC bus.

Parameters
PdxPointer to the device extension.
DeviceDevice (primary) address
SecaddrSecondary address
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 44 of file libiec/openclose.c.

References cbmiec_i_raw_write(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_parallel_burst_read ( IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Byte 
)
NTSTATUS cbmiec_parallel_burst_read_track ( IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Buffer,
IN ULONG  ReturnLength 
)
NTSTATUS cbmiec_parallel_burst_read_track_var ( IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Buffer,
IN ULONG  ReturnLength 
)
NTSTATUS cbmiec_parallel_burst_write ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Byte 
)
NTSTATUS cbmiec_pp_read ( IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Return 
)

Read a byte from the X[M|A]P1541 cable.

This function reads a byte from the parallel portion of the X[M|A]P1541 cable.

Parameters
PdxPointer to the device extension.
ReturnPointer to an UCHAR where the read byte is written to.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 79 of file ppread.c.

References cbmiec_i_pp_read_debounced(), CBMIEC_SET, FUNC_ENTER, PAR_PORT, PP_LP_BIDIR, and WRITE_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol(), cbmiec_parallel_burst_read(), and cbmiec_parallel_burst_write().

NTSTATUS cbmiec_pp_write ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Value 
)

Write a byte to the X[M|A]P1541 cable.

This function writes a byte to the parallel portion of the X[M|A]P1541 cable.

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

Definition at line 42 of file ppwrite.c.

References CBMIEC_RELEASE, DBG_PREFIX, FUNC_ENTER, FUNC_PARAM, PAR_PORT, PP_LP_BIDIR, and WRITE_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol(), and cbmiec_parallel_burst_write().

NTSTATUS cbmiec_raw_read ( IN PDEVICE_EXTENSION  Pdx,
OUT PUCHAR  Buffer,
IN ULONG  Size,
OUT ULONG *  Read 
)

Read some bytes from the IEC bus.

This function reads some bytes from the IEC bus. If debugging of function parameters is defined, output the given parameters and the returned values.

Parameters
PdxPointer to the device extension.
BufferPointer to a buffer where the read bytes are written to.
SizeMaximum number of characters to read from the bus.
ReadPointer to the variable which will hold the read bytes.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 48 of file rawread.c.

References cbmiec_i_raw_read(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_readwrite().

NTSTATUS cbmiec_raw_write ( IN PDEVICE_EXTENSION  Pdx,
IN const PUCHAR  Buffer,
IN ULONG  Size,
OUT ULONG *  Written 
)

Write some bytes to the IEC bus.

Parameters
PdxPointer to the device extension.
BufferPointer to a buffer where the read bytes are written to.
SizeMaximum number of characters to read from the bus.
WrittenPointer to the variable which will hold the number of written bytes.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

ATN is released on return of this routine

Definition at line 47 of file rawwrite.c.

References cbmiec_i_raw_write(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_readwrite().

VOID cbmiec_release_bus ( IN PDEVICE_EXTENSION  Pdx)

Release the IEC bus.

This function releases the IEC bus.

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 38 of file releasebus.c.

References cbmiec_checkcable(), CBMIEC_RELEASE, FUNC_ENTER, FUNC_LEAVE, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_OUT, and PP_RESET_OUT.

Referenced by cbm_execute_close(), cbm_lock_parport(), cbm_unlock_parport(), and cbmiec_cleanup().

NTSTATUS cbmiec_reset ( IN PDEVICE_EXTENSION  Pdx)

Send a RESET to the IEC bus.

This function sends a RESET on the IEC bus.

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 103 of file reset.c.

References CBMIEC_RELEASE, cbmiec_schedule_timeout(), CBMIEC_SET, cbmiec_wait_for_drives_ready(), DBG_PREFIX, DBG_SUCCESS, FUNC_ENTER, libiec_global_timeouts, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_OUT, PP_LP_BIDIR, PP_LP_IRQ, PP_RESET_OUT, and IEC_TIMEOUTS::T_holdreset.

Referenced by cbm_execute_createopen(), and cbm_execute_devicecontrol().

BOOLEAN cbmiec_send_byte ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Byte 
)

Write one byte to the IEC bus.

Parameters
PdxPointer to the device extension.
ByteThe byte to be output
Returns
If the routine succeeds - that is, the listener acknowledged the byte -, it returns TRUE. Otherwise, it returns FALSE.

Definition at line 39 of file sendbyte.c.

References cbmiec_block_irq(), CBMIEC_GET, CBMIEC_RELEASE, cbmiec_release_irq(), CBMIEC_SET, CBMIEC_SET_RELEASE, cbmiec_udelay(), DBG_PREFIX, DBG_SUCCESS, FUNC_ENTER, FUNC_LEAVE_BOOLEAN, libiec_global_timeouts, PERF_EVENT_WRITE_BIT_NO, PP_CLK_OUT, PP_DATA_IN, PP_DATA_OUT, IEC_TIMEOUTS::T_15_SEND_BEFORE_BIT_DELAY_T_S, IEC_TIMEOUTS::T_16_SEND_BIT_TIME_T_V, IEC_TIMEOUTS::T_17_SEND_FRAME_HANDSHAKE_T_F, and IEC_TIMEOUTS::T_17_Times.

Referenced by cbmiec_i_raw_write().

VOID cbmiec_set_cabletype ( IN PDEVICE_EXTENSION  Pdx,
IN IEC_CABLETYPE  CableType 
)

Set the type of the IEC cable.

This function sets the type of the IEC cable.

Parameters
PdxPointer to the device extension.
CableTypeThe type of the cable.

Definition at line 139 of file libiec/init.c.

References CABLESTATE_UNKNOWN, cbmiec_setcablestate(), FUNC_ENTER, and FUNC_LEAVE.

Referenced by cbm_init_registry().

NTSTATUS cbmiec_talk ( IN PDEVICE_EXTENSION  Pdx,
IN UCHAR  Device,
IN UCHAR  Secaddr 
)

Send a TALK over the IEC bus.

This function sends a TALK to the IEC bus.

Parameters
PdxPointer to the device extension.
DeviceDevice (primary) address
SecaddrSecondary address
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 44 of file talk.c.

References cbmiec_i_raw_write(), DBG_PREFIX, FUNC_ENTER, and FUNC_PARAM.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_test_irq ( IN PDEVICE_EXTENSION  Pdx,
OUT PVOID  Buffer,
IN ULONG  BufferLength 
)

Test for IRQ capabilities.

This function tests if the parallel port is able to generate interrupts.

Parameters
PdxPointer to the device extension of the device to be tested.
Buffer@@\xrefitem todo 169.
BufferLength@@\xrefitem todo 170.

Definition at line 41 of file testirq.c.

References CBMIEC_RELEASE, CBMIEC_SET, cbmiec_udelay(), DBG_ASSERT, DBG_ERROR, DBG_PREFIX, DbgFlags, CBMT_I_TESTIRQ::ErrAcquireIrq, CBMT_I_TESTIRQ::ErrIrqFallingEdge, CBMT_I_TESTIRQ::ErrIrqRisingEdge, FUNC_ENTER, LogErrorOnly, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_OUT, PP_LP_IRQ, PP_RESET_OUT, READ_PORT_UCHAR, and WRITE_PORT_UCHAR.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_unlisten ( IN PDEVICE_EXTENSION  Pdx)

Send an UNLISTEN over the IEC bus.

This function sends an UNLISTEN to the IEC bus.

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 38 of file unlisten.c.

References cbmiec_i_raw_write(), and FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_untalk ( IN PDEVICE_EXTENSION  Pdx)

Send an UNTALK over the IEC bus.

This function sends an UNTALK to the IEC bus.

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 38 of file untalk.c.

References cbmiec_i_raw_write(), and FUNC_ENTER.

Referenced by cbm_execute_devicecontrol().

NTSTATUS cbmiec_wait_for_drives_ready ( IN PDEVICE_EXTENSION  Pdx)

Wait for the drives to become ready after a RESET.

This function waits for the drives to become ready after they have got a RESET.

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 39 of file reset.c.

References cbmiec_check_device(), cbmiec_schedule_timeout(), DBG_PREFIX, DBG_PRINT, FUNC_ENTER, IEC_CHECKDEVICE_BUSBUSY, IEC_CHECKDEVICE_BUSFREE, and IEC_CHECKDEVICE_NODEVICE.

Referenced by cbmiec_reset().

VOID cbmiec_wait_for_listener ( IN PDEVICE_EXTENSION  Pdx,
IN BOOLEAN  SendEoi 
)

Wait until listener is ready to receive.

This function waits until a listener is ready.

Parameters
PdxPointer to the device extension.
SendEoiTRUE if we want to signal an EOI. FALSE otherwise.
Todo:
Shouldn't we make sure that there is no spurious interrupt until now?
Bug:
This implementation can lock up the whole machine, thus, do not use it!

Definition at line 80 of file waitlistener.c.

References cbmiec_block_irq(), CBMIEC_GET, CBMIEC_RELEASE, cbmiec_release_irq(), cbmiec_schedule_timeout(), CBMIEC_SET, DBG_ASSERT, DBG_PREFIX, DBG_SUCCESS, DBG_VERIFY, DBGDO, FUNC_ENTER, FUNC_LEAVE, libiec_global_timeouts, PP_CLK_OUT, PP_DATA_IN, PP_LP_IRQ, QueueShouldCancelCurrentIrp(), and IEC_TIMEOUTS::T_WaitForListener_Granu_T_H.

Referenced by cbmiec_i_raw_write().