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

i_iec.h File Reference

Internal functions and definitions of the libiec library. More...

#include "iec.h"

Go to the source code of this file.

Defines

#define PARALLEL_DATA_OFFSET   0
#define PARALLEL_STATUS_OFFSET   1
#define PARALLEL_CONTROL_OFFSET   2
#define PARALLEL_REGISTER_SPAN   3
#define PP_ATN_OUT   0x01
 The ATN OUT bit.
#define PP_CLK_OUT   0x02
 The CLOCK OUT bit.
#define PP_DATA_OUT   0x04
 The DATA OUT bit.
#define PP_RESET_OUT   0x08
 The RESET OUT bit.
#define PP_LP_IRQ   0x10
 Bit for allowing interrupts of the LPT.
#define PP_LP_BIDIR   0x20
 Bit for setting set bidirectional mode of the LPT.
#define PP_ATN_IN   0x10
 The ATN IN bit.
#define PP_CLK_IN   0x20
 The CLOCK IN bit.
#define PP_DATA_IN   0x40
 The DATA IN bit.
#define PP_RESET_IN   0x80
 The RESET IN bit.
#define PAR_PORT   (Pdx->ParPortPortAddress + PARALLEL_DATA_OFFSET)
#define IN_PORT   (Pdx->ParPortPortAddress + PARALLEL_STATUS_OFFSET)
#define OUT_PORT   (Pdx->ParPortPortAddress + PARALLEL_CONTROL_OFFSET)
#define CBMIEC_SET(_set)   Pdx->IecOutBits|=(_set); WRITE_PORT_UCHAR(OUT_PORT,(UCHAR)(Pdx->IecOutEor ^ Pdx->IecOutBits))
#define CBMIEC_RELEASE(_rel)   Pdx->IecOutBits&=~(_rel); WRITE_PORT_UCHAR(OUT_PORT,(UCHAR)(Pdx->IecOutEor ^ Pdx->IecOutBits))
#define CBMIEC_SET_RELEASE(_set, _rel)
#define CBMIEC_GET(_line)   ((READ_PORT_UCHAR(IN_PORT)&_line)==0?1:0)
#define cbmiec_show_state(_x_, _y_)
 A cbmiec_show_state() implementation for release builds.

Typedefs

typedef IEC_TIMEOUTS IEC_TIMEOUTS

Functions

VOID cbmiec_schedule_timeout (IN ULONG howlong)
 Schedule a timeout.
VOID cbmiec_udelay (IN ULONG howlong)
 Wait for a timeout.
NTSTATUS cbmiec_i_raw_read (IN PDEVICE_EXTENSION Pdx, OUT UCHAR *buf, ULONG cnt, OUT ULONG *pReceived)
 Read some bytes from the IEC bus.
NTSTATUS cbmiec_i_raw_write (PDEVICE_EXTENSION Pdx, const UCHAR *buf, ULONG cnt, ULONG *pSent, BOOLEAN atn, BOOLEAN talk)
 Write some bytes to the IEC bus.
VOID cbmiec_block_irq (PDEVICE_EXTENSION Pdx)
 Block all interrupts.
VOID cbmiec_release_irq (PDEVICE_EXTENSION Pdx)
 Release the interrupts.

Variables

IEC_TIMEOUTS libiec_global_timeouts


Detailed Description

Internal functions and definitions of the libiec library.

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

Author:
Spiro Trikaliotis
Version:
Id
i_iec.h,v 1.35 2006/04/28 10:42:11 trikalio Exp


Definition in file i_iec.h.


Define Documentation

#define CBMIEC_GET _line   )     ((READ_PORT_UCHAR(IN_PORT)&_line)==0?1:0)
 

get the value of the parallel port

Definition at line 73 of file i_iec.h.

Referenced by cbmiec_check_device(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_send_byte(), and cbmiec_wait_for_listener().

#define CBMIEC_RELEASE _rel   )     Pdx->IecOutBits&=~(_rel); WRITE_PORT_UCHAR(OUT_PORT,(UCHAR)(Pdx->IecOutEor ^ Pdx->IecOutBits))
 

release an output line on the parallel port

Definition at line 67 of file i_iec.h.

Referenced by cbmiec_check_device(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_init(), cbmiec_pp_write(), cbmiec_release_bus(), cbmiec_reset(), cbmiec_send_byte(), and cbmiec_wait_for_listener().

#define CBMIEC_SET _set   )     Pdx->IecOutBits|=(_set); WRITE_PORT_UCHAR(OUT_PORT,(UCHAR)(Pdx->IecOutEor ^ Pdx->IecOutBits))
 

set an output line on the parallel port

Definition at line 65 of file i_iec.h.

Referenced by cbmiec_check_device(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_init(), cbmiec_pp_read(), cbmiec_reset(), cbmiec_send_byte(), and cbmiec_wait_for_listener().

#define CBMIEC_SET_RELEASE _set,
_rel   ) 
 

Value:

Pdx->IecOutBits|=(_set); Pdx->IecOutBits&=~(_rel); \
                                      WRITE_PORT_UCHAR(OUT_PORT,(UCHAR)(Pdx->IecOutEor ^ Pdx->IecOutBits))
set and release an output line on the parallel port (simultaneously)

Definition at line 69 of file i_iec.h.

Referenced by cbmiec_iec_setrelease(), and cbmiec_send_byte().

#define IN_PORT   (Pdx->ParPortPortAddress + PARALLEL_STATUS_OFFSET)
 

Get the address of the parallel port STATUS register (= the port for input) out of the Pdx info

Definition at line 59 of file i_iec.h.

Referenced by cbmiec_iec_poll(), cbmiec_iec_wait(), and cbmiec_interrupt().

#define OUT_PORT   (Pdx->ParPortPortAddress + PARALLEL_CONTROL_OFFSET)
 

Get the address of the parallel port CONTROL register (= the port for output) out of the Pdx info

Definition at line 62 of file i_iec.h.

#define PAR_PORT   (Pdx->ParPortPortAddress + PARALLEL_DATA_OFFSET)
 

Get the address of the parallel port DATA register out of the Pdx info

Definition at line 56 of file i_iec.h.

Referenced by cbmiec_pp_read(), and cbmiec_pp_write().

#define PARALLEL_CONTROL_OFFSET   2
 

the CONTROL register is located here

Definition at line 32 of file i_iec.h.

#define PARALLEL_DATA_OFFSET   0
 

the DATA register is located here

Definition at line 28 of file i_iec.h.

#define PARALLEL_REGISTER_SPAN   3
 

the count of port addresses the parallel port occupies

Definition at line 34 of file i_iec.h.

#define PARALLEL_STATUS_OFFSET   1
 

the STATUS register is located here

Definition at line 30 of file i_iec.h.


Typedef Documentation

typedef struct IEC_TIMEOUTS IEC_TIMEOUTS
 

The various timeouts of the IEC bus protocol


Function Documentation

VOID cbmiec_block_irq PDEVICE_EXTENSION  Pdx  ) 
 

Block all interrupts.

This function blocks all interrupt, thus that we cannot be interrupted while executing some critical things.

This should not be used for big time periods.

Definition at line 95 of file libiec/util.c.

References CLI(), DBG_ASSERT, DBGDO, FUNC_ENTER, and FUNC_LEAVE.

Referenced by cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_send_byte(), and cbmiec_wait_for_listener().

NTSTATUS cbmiec_i_raw_read IN PDEVICE_EXTENSION  Pdx,
OUT UCHAR *  Buffer,
ULONG  Count,
OUT ULONG *  Received
 

Read some bytes from the IEC bus.

Parameters:
Pdx Pointer to the device extension.
Buffer Pointer to a buffer where the read bytes are written to.
Count Maximum number of characters to read from the bus.
Received Pointer 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 46 of file i_rawread.c.

References cbmiec_block_irq(), CBMIEC_GET, CBMIEC_RELEASE, cbmiec_release_irq(), cbmiec_schedule_timeout(), CBMIEC_SET, cbmiec_udelay(), DBG_ASSERT, DBG_ERROR, DBG_PREFIX, DBG_SUCCESS, FUNC_ENTER, libiec_global_timeouts, PERF_EVENT_READ_BIT_NO, PERF_EVENT_READ_BYTE, PERF_EVENT_READ_BYTE_NO, PP_CLK_IN, PP_DATA_IN, PP_DATA_OUT, QueueShouldCancelCurrentIrp(), IEC_TIMEOUTS::T_1_RECV_WAIT_CLK_LOW_DATA_READY_GRANU, IEC_TIMEOUTS::T_2_RECV_WAIT_CLK_HIGH_T_NE, IEC_TIMEOUTS::T_2_Times, IEC_TIMEOUTS::T_3_RECV_EOI_RECOGNIZED, IEC_TIMEOUTS::T_4_RECV_WAIT_CLK_HIGH_AFTER_EOI_GRANU, IEC_TIMEOUTS::T_4_Times, IEC_TIMEOUTS::T_5_RECV_BIT_WAIT_CLK_HIGH, IEC_TIMEOUTS::T_5_Times, IEC_TIMEOUTS::T_6_RECV_BIT_WAIT_CLK_LOW, IEC_TIMEOUTS::T_6_Times, and IEC_TIMEOUTS::T_7_RECV_INTER_BYTE_DELAY.

Referenced by cbmiec_raw_read().

NTSTATUS cbmiec_i_raw_write PDEVICE_EXTENSION  Pdx,
const UCHAR *  Buffer,
ULONG  Count,
ULONG *  Sent,
BOOLEAN  Atn,
BOOLEAN  Talk
 

Write some bytes to the IEC bus.

Parameters:
Pdx Pointer to the device extension.
Buffer Pointer to a buffer where the read bytes are written to.
Count Maximum number of characters to read from the bus.
Sent Pointer to the variable which will hold the number of written bytes.
Atn If true: Sent the bytes with set ATN; else, with released ATN
Talk If true: A talk command is to be sent (some special care has to be taken at the end of the transmission).
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 55 of file i_rawwrite.c.

References cbmiec_block_irq(), CBMIEC_GET, CBMIEC_RELEASE, cbmiec_release_irq(), cbmiec_schedule_timeout(), cbmiec_send_byte(), CBMIEC_SET, cbmiec_udelay(), cbmiec_wait_for_listener(), DBG_ASSERT, DBG_ERROR, DBG_PREFIX, DBG_SUCCESS, DebugNtStatus(), _DEVICE_EXTENSION::Eoi, FUNC_ENTER, _DEVICE_EXTENSION::IrqCount, _DEVICE_EXTENSION::IsSMP, libiec_global_timeouts, PERF_EVENT_WRITE_BYTE, PERF_EVENT_WRITE_BYTE_NO, PP_ATN_OUT, PP_CLK_OUT, PP_DATA_IN, PP_DATA_OUT, QueueShouldCancelCurrentIrp(), IEC_TIMEOUTS::T_10_SEND_BEFORE_1ST_BYTE, IEC_TIMEOUTS::T_11_SEND_BEFORE_BYTE_DELAY, IEC_TIMEOUTS::T_12_SEND_AFTER_BYTE_DELAY, IEC_TIMEOUTS::T_13_SEND_TURN_AROUND_LISTENER_TALKER_T_TK, IEC_TIMEOUTS::T_14_SEND_AT_END_DELAY, IEC_TIMEOUTS::T_9_SEND_WAIT_DEVICES_T_AT, and IEC_TIMEOUTS::T_9_Times.

Referenced by cbmiec_close(), cbmiec_listen(), cbmiec_open(), cbmiec_raw_write(), cbmiec_talk(), cbmiec_unlisten(), and cbmiec_untalk().

VOID cbmiec_release_irq PDEVICE_EXTENSION  Pdx  ) 
 

Release the interrupts.

This function releases all interrupt, undoing a previous cbmiec_block_irq() call.

Definition at line 119 of file libiec/util.c.

References DBG_ASSERT, DBGDO, FUNC_ENTER, FUNC_LEAVE, and STI().

Referenced by cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_send_byte(), and cbmiec_wait_for_listener().

VOID cbmiec_schedule_timeout IN ULONG  Howlong  ) 
 

Schedule a timeout.

This function schedules a timeout. Scheduling means that other threads have the opportunity to use the processor while we're waiting.

Parameters:
Howlong How long to wait (in us)

Definition at line 35 of file libiec/util.c.

References FUNC_ENTER, and FUNC_LEAVE.

Referenced by cbmiec_check_device(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_iec_wait(), cbmiec_reset(), and cbmiec_wait_for_listener().

VOID cbmiec_udelay IN ULONG  Howlong  ) 
 

Wait for a timeout.

This function waits for a timeout. Waiting means that we want to have an exact timing, so don't give away the processor.

Parameters:
Howlong How long to wait (in us)

Definition at line 67 of file libiec/util.c.

Referenced by cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_iec_wait(), cbmiec_send_byte(), and ParPortSetMode().


Variable Documentation

IEC_TIMEOUTS libiec_global_timeouts
 

timeout values

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

Referenced by cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_iec_wait(), cbmiec_reset(), cbmiec_send_byte(), and cbmiec_wait_for_listener().


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