                      TVicPort.DLL version 3.0
                      ========================

               Copyright (C) 1997,1998,1999 Victor Ishikeev
             e-mail: ivi@ufanet.ru, tools@entechtaiwan.com
                 http://www.entechatiwan.com/tools.htm


                             AS_DLL.TXT
                            ============

CONTENTS
========

1. GENERAL TVicPort FUNCTIONS
2. DIRECT PORT I/O WITH TVicPort
3. SPECIFIC WORK WITH THE LPT PORT
4. HDD SERIAL NUMBER


1. GENERAL TVicPort FUNCTIONS
=============================

TVicPort has the following general functions:

    BOOL OpenTVicPort();
    ----------------------------------------------------------
    Loads the VxD or SYS kernel-mode driver, providing direct access to the 
    hardware. If the kernel-mode driver was successfully opened, the
    IsDriverOpened() returns True; if the function fails, the IsDriverOpened() 
    returns False.

    void CloseTVicPort();
    ---------------------
    Closes the kernel-mode driver and releases memory allocated to it.
    If the driver was successfully closed, the IsDriverOpened() always 
    returns False.

    BOOL IsDriverOpened();
    ----------------------
    This boolean function specifies whether the kernel-mode driver is open.
    Returns True if the driver is already open, or False if it is not.


2. DIRECT PORT I/O WITH TVicPort
================================

The following functions permit direct I/O port access:
------------------------------------------------------

    UCHAR  ReadPort  (USHORT PortAddr);                // read one byte 
    USHORT ReadPortW (USHORT PortAddr);                // read one word
    ULONG  ReadPortL (USHORT PortAddr);                // read four bytes
    void   WritePort (USHORT PortAddr, UCHAR  bData);  // write one byte
    void   WritePortW(USHORT PortAddr, USHORT wData);  // write one word
    void   WritePortL(USHORT PortAddr, ULONG  lData);  // write four bytes

    The following functions allow read/write many values to the same port address.

    void   ReadPortFIFO  (USHORT PortAddr, USHORT NumPorts, UCHAR  * Buffer);
    -------------------------------------------------------------------------
    Reads a "NumPorts" byte data values from the port address specified by 
    PortAddr to the Buffer.

    void   WritePortFIFO (USHORT PortAddr, USHORT NumPorts, UCHAR  * Buffer);
    -------------------------------------------------------------------------
    Writes a "NumPorts" word data values to the port address specified by 
    PortAddr from the Buffer.

    void   ReadPortWFIFO (USHORT PortAddr, USHORT NumPorts, USHORT * Buffer);
    -------------------------------------------------------------------------
    Reads a "NumPorts" word values from the port address specified by PortAddr
    to the Buffer.

    void   WritePortWFIFO(USHORT PortAddr, USHORT NumPorts, USHORT * Buffer);
    -------------------------------------------------------------------------
    Writes a "NumPorts" word data values to the port address specified by 
    PortAddr from the Buffer.


    void  SetHardAccess(BOOL HardAccess);
    -------------------------------------
    The SetHardAccess() function determines whether the kernel-mode driver
    should use "hard" or "soft" access to the I/O ports. If set to True
    "hard" access is employed; if set to False "soft" access is employed.

    "Soft" access provides higher performance access to ports, but may fail
    if the port(s) addressed are already in use by another kernel-mode
    driver. While slower, "Hard" access provides more reliable access to
    ports which have already been opened by another kernel-mode driver. 

    BOOL  TestHardAccess();
    -----------------------
    Returns True is "hard" access is used.

3. SPECIFIC WORK WITH THE LPT PORT (NEW!)

Now TVicPort provides extended functions for work with the printer (LPT) port.   
See test examples for more info.

==== BASE ====

    short GetLPTNumPorts(); 
    -----------------------
    Shows how many LPT ports are installed on your PC.

    short GetLPTNumber(); 
    ---------------------
    Shows current LPT number.

    void  SetLPTNumber(short nNewValue); 
    ------------------------------------
    Allows select a current LPT port.

    short GetLPTBasePort(hPort);
    ----------------------------
    Returns a base address of the current LPT port.

==== PINS ====

    BOOL GetPin(short nPin);
    ------------------------
    Allows read an electrical level from the select pin of current 
    LPT port. Returns TRUE if current level is HIGH.

    void SetPin(short nPin, BOOL nNewValue);
    ----------------------------------------
    Allows write an electrical level to the selected pin.
    If nNewValue = TRUE - HIGH level.

    Note: Not all pins are accessible for this operation. Run test example
          for more info.

==== STATUS ====

    BOOL GetLPTAckwl();
    -------------------
    Returns ACKWL state from the printer

    BOOL GetLPTBusy();
    ------------------
    Returns BUSY state from the printer

    BOOL GetLPTPaperEnd();
    ----------------------
    Returns PAPER END state from the printer
    
    BOOL GetLPTSlct();
    ------------------
    Returns SLCT state from the printer

    BOOL GetLPTError();
    -------------------
    Returns ERROR state from the printer

=== COMMANDS ===

    void LPTStrobe();
    -----------------
    Sends STROBE signal to the printer

    void LPTAutofd(BOOL Flag);
    --------------------------
    Sets current AUTOFD  state on printer

    void LPTInit();
    ---------------
    Resets printer by sending INIT signal

    void LPTSlctIn();
    -----------------
    Sends SLCTIN signal to the printer


4. HDD SERIAL NUMBER

    void GetHDDInfo(unsigned char IdeNumber, // Ide controller number (1 or 2)
                    unsigned char Master,    // Master/Slave (Master=1, Slave=0)
                    PHDDInfo HDDInfo);       // Hardware information
    ---------------------------------------------------------------------------
    This function allows read a "hardware" serial IDE HDD number and
    some other information (see a test example for more info). 
    Note that it does not works  for the SCSI HDD  controller.

 
5. CONTACT INFORMATION
======================

    Comments, questions and suggestions regarding TVicPort can be directed 
by e-mail to ivi@ufanet.ru or tools@entechtaiwan.com. 

With best wishes,

Victor Ishikeev
May 1999
