
             RAYON MULTIPORT I/O PROCESSOR DOCUMENTATION FOR NT/95/98
             --------------------------------------------------------

  This program is based on Windows NT/95/98 WIN32 API. All cards support
WIN32 API can be used with our demo program.

        ** the common return codes are defined as follows **

                OK       0
                FAIL    -1
                TRUE     1
                FALSE    0
                ON       1
                OFF      0

        ** the following is the function list **

        (1)  IOP_Open
        (2)  IOP_Putc
        (3)  IOP_Getc
        (4)  IOP_Write
        (5)  IOP_Read
        (6)  IOP_DOQ_Count
        (7)  IOP_DIQ_Count
        (8)  IOP_ResetDOQ
        (9)  IOP_ResetDIQ
        (10) IOP_SetDTR
        (11) IOP_SetRTS
        (12) IOP_Close
        (13) IOP_Ioctrl
        (14) IOP_Flowctrl
        (15) IOP_GetIoctrl
        (16) IOP_GetFlowctrl
        (17) IOP_Status
        (18) IOP_DataStatus

        ** the following is detailed function descriptions **


        *-----[ IOP_Open ]-----------------------------------------------------

        FUNCTION :  Open a specific serial port for transmit/receive.

        PROTOTYPE : int IOP_Open(int port, int cflag)

        ARGUMENTS : port  -- port number
                    cflag -- Communication parameters (see below)


          15  14  13  12  11  10  9  8   7   6   5  4   3  2  1  0
        +---+---+---+---+---+----------+---+---+------+------------+
        | X | X | X | P | C |  Parity  | R | S | WLen | Baud Rate  |
        +---+---+---+---+---+----------+---+---+------+------------+
                      |   |     |        |   |   |          |
                      |   |     |        |   |   |          HangUp
                      |   |     |        |   | Word length  0 0 0 0  :    110
                      |   |  00 : None   |   |   00 : 5     0 0 0 1  :    300
                      |   |  01 : Even   |   |   01 : 6     0 0 1 0  :    600
                      |   |  10 : Odd    |   |   10 : 7     0 0 1 1  :   1200
                      |   |  11 : Mark   |   |   11 : 8     0 1 0 0  :   2400
                      |   |  100: Space  |   |              0 1 0 1  :   4800
                      |   |              | Stop bits        0 1 1 0  :   9600
                      | Close HangUp     |   0 : One        0 1 1 1  :  14400
                      | 0 : Disable      |   1 : Two        1 0 0 0  :  19200
                      | 1 : Enable       |                  1 0 0 1  :  38400
                      |              Software flow control  1 0 1 0  :  xxxxx
                      Port Type       (XON/XOFF)            1 0 1 1  :  57600
                      0 : Modem       0 : Disable           1 1 0 0  : 115200
                      1 : Local       1 : Enable            1 1 0 1  : xxxxxx
                                                            1 1 1 0  : xxxxxx

        X              -- Reserved
        Software flow  -- Enable or Disable XONXOFF
        Close Hangup   -- After close, inactive CTS & RTS
        Port Type      --
                Local : The line is assumed to be a local, direct
                        connection with no modem control, The DTR
                        and RTS signals are asserted, but incomming
                        modem signals are ignored.

                Modem : The DTR and RTS signals are asserted. Also,
                        the carrier deetect signal must be returned
                        before communications can proceed.

        NOTE : All ports are opened with OVERLAPPED structure

        RETURN :    OK   -- succes
                    FALL -- error


        *-----[ IOP_Putc ]-----------------------------------------------------

        FUNCTION :  Write a character to the output buffer of a specific
                    serial port.

        PROTOTYPE : int IOP_Putc(int port, LPSTR c)

        ARGUMENTS : port -- port number
                    c    -- character to be written

        RETURN :    OK   -- success
                    FAIL -- error


        *-----[ IOP_Getc ]-----------------------------------------------------

        FUNCTION :  Read a character from the input buffer of a specific
                    serial port.

        PROTOTYPE : int IOP_Getc(int port, LPSTR c)

        ARGUMENTS : port -- port number
                    c    -- buffer to store the received character

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_Write ]----------------------------------------------------

        FUNCTION :  Write characters to the output buffer of a specific
                    serial port.

        PROTOTYPE : DWORD IOP_Write(int port, LPSTR buffer,int count)

        ARGUMENTS : port   -- port number
                    buffer -- buffer characters to be written
                    count  -- number of bytes want to write

        RETURN :    Number of bytes Actually be written
                    FAIL -- error


        *-----[ IOP_Read ]-----------------------------------------------------

        FUNCTION :  Read characters from the input buffer of a specific
                    serial port.

        PROTOTYPE : DWORD IOP_Read(int port, LPSTR buffer, int count)

        ARGUMENTS : port   -- port number
                    buffer -- buffer to store the received characters
                    count  -- number of bytes want to receive

        RETURN :    Number of bytes really be received.
                    FAIL -- error


        *-----[ IOP_DOQ_Count ]------------------------------------------------

        FUNCTION :  Get the number of bytes of user data remaining to be
                    transmitted for all write operation.

        PROTOTYPE : DWORD IOP_DOQ_Count(int port)

        ARGUMENTS : port -- port number

        RETURN :    Number of bytes available in output queue for transmitting
                    FAIL -- error


        *-----[ IOP_DIQ_Count ]------------------------------------------------

        FUNCTION :  Get the number of bytes received by the serial provider but
                    not yet read by any read operation.
                    Before calling IOP_Read(), call this function to make  sure
                    there are characters in the input queue.

        PROTOTYPE : INT IOP_DIQ_Count(WORD card, WORD port)

        ARGUMENTS : port -- port number

        RETURN :    Number of bytes in the input queue that can be received
                    FAIL -- error


        *-----[ IOP_ResetDOQ ]-------------------------------------------------

        FUNCTION :  Flush all the data in the output queue.
                    Before calling IOP_Close, you  may  call  this  function to
                    make sure all data in output queue was flushed.

        PROTOTYPE : int IOP_ResetDOQ(int port)

        ARGUMENTS : port -- port number

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_ResetDIQ ]-------------------------------------------------

        FUNCTION :  Clear all the data in the input queue.

        PROTOTYPE : int IOP_ResetDIQ(int port)

        ARGUMENTS : port -- port number

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_SetDTR ]---------------------------------------------------

        FUNCTION :  Turn DTR of a specific port ON or OFF.

        PROTOTYPE : INT IOP_SetDTR(int port, int flag)

        ARGUMENTS : port -- port number
                    flag -- ON  :  turn DTR on
                            OFF :  turn DTR off
                            ON and OFF were defined in TTY.H

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_SetRTS ]---------------------------------------------------

        FUNCTION :  Turn RTS of a specific port ON or OFF.

        PROTOTYPE : INT IOP_SetRTS(int port, int flag)

        ARGUMENTS : port -- port number
                    flag -- ON  :  turn RTS on
                            OFF :  turn RTS off
                            ON and OFF were defined in IOPCALL.H

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_Close ]----------------------------------------------------

        FUNCTION :  Close a specific serial port.

        PROTOTYPE : int IOP_Close(int port)

        ARGUMENTS : port -- port number

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_Ioctrl ]---------------------------------------------------

        FUNCTION :  Change the parameter of a specific serial port

        PROTOTYPE : int   IOP_Ioctrl(int port, int cflag)

        ARGUMENTS : port  -- port number
                    param -- Communication parameters
                             See IOP_Open() for more detail

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_GetIoctrl ]------------------------------------------------

        FUNCTION :  Get the parameter of a specific serial port

        PROTOTYPE : int   IOP_GetIoctrl(int port)

        ARGUMENTS : port  -- port number

        RETURN :    See IOP_Open() for more detail


        *-----[ IOP_Flowctrl ]-------------------------------------------------

        FUNCTION :  Setting the software and hardware control of
                    a specific serial port

        PROTOTYPE : int   IOP_Flowctrl(int port, int cflag)

        ARGUMENTS : port  -- port number
                    cflag -- (see blow)


                          3   2   1   0
                        +---+---+---+---+
                        | X | R |RTS|DTR|
                        +---+---+---+---+
                          |   |   |   |
                     Reserved |   | DTR folw
                              |   | 0 : Enable
                              |   | 1 : HandShake
                              | RTS flow
                              | 0 : Enable
                              | 1 : HandShake
                              |
                           Sfotware flow control
                           0 : XONXOFF Disable
                           1 : XONXOFF Enable

        RETURN :    FAIL -- error
                    OK   -- success


        *-----[ IOP_GetFlowctrl ]----------------------------------------------

        FUNCTION :  Get the hardware and software control of a
                    specific serial port

        PROTOTYPE : int   IOP_GetFlowctrl(int port)

        ARGUMENTS : port  -- port number

        RETURN :    > 0 bit 0 on - DTR handshake, else DTR enable
                        bit 1 on - RTS handshake, else DTR enable
                        bit 2 on - XONXOFF enable, else disable
                        bit 3 on - DTR disable, else DTR enable or handshake
                        bit 4 on - RTS disable, else RTS enable or handshake


        *-----[ IOP_Status ]---------------------------------------------------

        FUNCTION :  Get the status of a specific port

        PROTOTYPE : int IOP_Status(int port)

        ARGUMENTS : port -- port number

        RETURN :    The communication status of this port (see below,  all bits
                    are defined in TTY.H


          15  14  13  12  11  10  9   8   7   6   5   4   3  2  1  0
        +---+---+---+---+---+---+---+---+---+---+---+---+------------+
        | X | X | X | S | T | D | R | C | M | O | X | X | Baud Rate  |
        +---+---+---+---+---+---+---+---+---+---+---+---+------------+
          |   |   |   |   |   |   |   |   |   |   |   |       |
     Reserved |   |  DSR  TX DCD  RX CTS  |  OPEN |   |     see IOP_Open()
              | Reserved              Modem line  | Reserved
           Reserved                            Reserved

                        O : Is Open.
                        M : Is Modem Line.
                        C : Clear To Send (CTS).
                        R : Receive Ready (RxRdy).
                        D : Data Carrier Detect (DCD).
                        T : Transmit Empty (TxEmpt).
                        S : Data Set Ready (DSR).


        *-----[ IOP_DataStatus ]----------------------------------------------

        FUNCTION :  Check if any error happened when receiving data
                    of a specific serial port

        PROTOTYPE : int   IOP_DataStatus(int port)

        ARGUMENTS : port  -- port number

        RETURN :    = 0 no error happened
                    > 0 bit 0 on - overrun error
                        bit 1 on - overflow error
                        bit 2 on - parity error
                        bit 3 on - TX full error


                       DEMO PROGRAM : DEMO.EXE


                The DEMO program  DEMO.EXE is used to test the functionality of
        PCIIOP.

                By using DEMO source program, programmers can learn how to work
        with  PCIIOP  card and it's driver. This program was written for Visual
        C++ compiler,  if you're using another compiler,  just modify some fun-
        ction names supported by your compiler.

        The DEMO program contains the following files in \DEMO directory :

                        1. DEMO.C      --  Main Module of DEMO program
                        2. DEMO.H      --  Include file for DEMO.C
                        3. DEMO.RC     --  Resource file for DEMO.C
                        4. DEMO.DEF    --  Function code listed for DEMO.C
                        5. TTY.C       --  Callable interface to driver
                        6. TTY.H       --  Include file for TTY.C
                        7. TTY.DEF     --  Function code listed for TTY.C
                        8. TTY.LIB     --  Import library
                        9. TTY.DLL     --  Dynamic link library
                       10. RESOURCE.H  --  Include file for DEMO.C and DEMO.RC
                       11. MAKEFILE    --  Makefile for building DEMO program
                       12. DEMO.EXE    --  Execution file

        [ RUNNING ]

                Before running this DEMO program,  make sure you have installed
        the  PCIIOP  driver.  If the PCIIOP driver was installed, You could run
        the DEMO program now :

                EXAMPLE: A> DEMO

                Now,  you can see  8 boxs on the screen.  Each box represents a
        serial port. There are 3 bars in each box that show input status ( data
        count or  Dynamic through type or  Static through type ), output status
        ( data count or Dynamic through type or Static through type ) and check
        data  transmit is  success or  error  (it will check the input data and
        output data is the same or not).  When the port transmit was error, the
        bar will  shows  "ERROR",  and then it will write a file  PORT?.ERR for
        user to find the error, and the open port will be close.

        [ OPERATING ]

                While the DEMO program is running, you could control the behav-
        ior of the ports of PCIIOP (even standard port COM1/2). The Action menu
        item can be  selected to connect or  disconnecte the  DEMO program.  If
        DEMO program were connected, the ports will be open,  and then the open
        ports will transmit data.  If you disconnect the DEMO program, the open
        ports will be close.

           < MENU ITEM >

           Action :
              CONNECT - Connect the DEMO program
              DISCONNECT - Disconnect the DEMO program
              EXIT - exit the DEMO program

           Settings :

           --COM Options--

           Start Port  -- the start port number of the range that
                          you want to open
           End port    -- the end port number of the range that
                          you want to open
           Baud Rate   -- specify the baud rate
           Data Bits   -- the data bits selection
           Parity      -- the parity selection
           Stop Bits   -- send 2 stop bits or 1 stop bit
           *Flow
           DTR/DSR     -- DTR/DSR enable or handshake state
           RTS/CTS     -- RTS/CTS enable or handshake state
           XON/XOFF    -- XON/XOFF enable or disable state

           NOTE:the DTR/DSR,RTS/CTS,XON/XOFF that you can select one or
                more of the the parameter

           --DEMO Show--

           Start Look  -- the start port number that you want to show
           Count Out   -- count source out type
           Dynamic     -- dynamic throughput type
           Static      -- static throughput type

           NOTE:the "Count Out","Dynamic","Static" that you can select
                one of the type

