home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / PCL4C50.ZIP / PCL4CREF.DOC < prev    next >
Encoding:
Text File  |  1995-11-20  |  55.6 KB  |  1,701 lines

  1.  
  2.  
  3.                        Personal Communications Library
  4.  
  5.                              For the C Language
  6.  
  7.  
  8.                                   (PCL4C)
  9.  
  10.  
  11.  
  12.                              REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                 Version 5.0
  19.  
  20.                              November 20, 1995
  21.  
  22.  
  23.  
  24.  
  25.                        This software is provided as-is.
  26.                 There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                             Copyright (C) 1995
  32.                             All rights reserved
  33.  
  34.  
  35.  
  36.                          MarshallSoft Computing, Inc.
  37.                             Post Office Box 4543
  38.                             Huntsville AL 35815
  39.  
  40.  
  41.                          Voice : 205-881-4630
  42.                            FAX : 205|880|0925
  43.                            BBS : 205-880-9748
  44.                          email : msc@traveller.com
  45.                       Anon FTP : ftp.traveller.com  /pub/users/msc
  46.                            web : www.traveller.com/~msc/
  47.  
  48.  
  49.                                   _______
  50.                              ____|__     |                (R)
  51.                           --+       |    +-------------------
  52.                             |   ____|__  |  Association of
  53.                             |  |       |_|  Shareware
  54.                             |__|   o   |    Professionals
  55.                           --+--+   |   +---------------------
  56.                                |___|___|    MEMBER
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. PCL4C Reference Manual                                              Page 1
  69.                             C O N T E N T S
  70.  
  71.  
  72.  
  73.         Chapter                                     Page
  74.  
  75.         Table of Contents.............................2
  76.         Introduction..................................3
  77.            SioBaud....................................4
  78.            SioBrkKey..................................4
  79.            SioBrkSig..................................5
  80.            SioCTS.....................................5
  81.            SioDCD.....................................6
  82.            SioDelay...................................6
  83.            SioDone....................................7
  84.            SioDSR.....................................7
  85.            SioDTR.....................................8
  86.            SioError...................................8
  87.            SioFIFO....................................9
  88.            SioFlow....................................9
  89.            SioGetc...................................10
  90.            SioGetDiv.................................10
  91.            SioGets...................................11
  92.            SioInfo...................................11
  93.            SioIRQ....................................12
  94.            SioLine...................................12
  95.            SioLoopBack...............................13
  96.            SioModem..................................13
  97.            SioParms..................................14
  98.            SioPorts..................................14
  99.            SioPutc...................................15
  100.            SioPuts...................................15
  101.            SioRead...................................16
  102.            SioReset..................................16
  103.            SioRI.....................................17
  104.            SioRTS....................................17
  105.            SioRxBuf..................................18
  106.            SioRxClear................................18
  107.            SioRxQue..................................19
  108.            SioTimer..................................19
  109.            SioTxBuf..................................20
  110.            SioTxClear................................20
  111.            SioTxFlush................................21
  112.            SioTxQue..................................21
  113.            SioUART...................................22
  114.            SioUnGetc.................................22
  115.         Function Summary.............................23
  116.         Error Code Summary...........................24
  117.         Code Examples................................25
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PCL4C Reference Manual                                              Page 2
  137. Introduction
  138.  
  139.  
  140.  
  141. This manual lists all of the  PCL4C  functions  in  alphabetical  order.  Every
  142. library function will return a value as follows:
  143.  
  144. 1.   Negative  values  for error conditions. See last page of this manual for a
  145. list of error values and their meanings.
  146.  
  147. 2.  Non-negative values when returning data (eg: SioLine).
  148.  
  149. 3.  Zero otherwise.
  150.  
  151. When debugging an application, be sure to test all return values. Use  SioError
  152. to print the associated text for errors.
  153.  
  154. Example Code Segment
  155.  
  156.  
  157. +---------------------------------------------------------------+
  158. | int Code;                 /* MUST be 'int', not 'char' */     |
  159. |                                                               |
  160. | Code = SioFunction( );    /* any PCL4C function */            |
  161. | if(Code<0)                                                    |
  162. |   {/* error returned */                                       |
  163. |    SioError(Code);        /* SioError prints error text */    |
  164. |    SioDone(Port);         /* always call SioDone last */      |
  165. |    exit(1);                                                   |
  166. |   }                                                           |
  167. | /* no errors */                                               |
  168. | ...your application code...                                   |
  169. |                                                               |
  170. +---------------------------------------------------------------+
  171.  
  172.  
  173. For  more  examples,  examine each of the example programs provided (MINIMAL.C,
  174. SIMPLE.C, LOGIN.C, DOOR.C,  SPAWN.C,  SELFTEST.C,  etc.)  in  the  distribution
  175. archive.
  176.  
  177. You may also wish to examine the TERM.C example program in the protocol library
  178. (PPL4C).
  179.  
  180. Refer to the User's Manual (PCL4C.USR) for additional information.
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. PCL4C Reference Manual                                              Page 3
  205. +-------------+---------------------------------------------------------------+
  206. |   SioBaud   |  Sets the baud rate of the selected port.                     |
  207. +-------------+---------------------------------------------------------------+
  208.  
  209. Syntax    int SioBaud(int Port,int BaudCode)
  210.           /* Port:      Port selected (COM1 - COM16) */
  211.           /* BaudCode:  Baud code */
  212.  
  213.  Remarks  The SioBaud function sets the baud rate without resetting  the  port.
  214.           It is used to change the baud rate after calling SioReset.
  215.  
  216.           Code   Rate    Name             Code   Rate   Name
  217.              0     300    Baud300            5    9600   Baud9600
  218.              1     600    Baud600            6   19200   Baud19200
  219.              2    1200    Baud1200           7   38400   Baud38400
  220.              3    2400    Baud2400           8   57600   Baud57600
  221.              4    4800    Baud4800           9  115200   Baud115200
  222.  
  223.  
  224.  Returns   -4 : No such port. Expect 0 to MaxPort.
  225.           -11 : Bad baud rate code. See above code values.
  226.  
  227. See Also  SioReset
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238. +-------------+------------+-------------------+------------------------------+
  239. |  SioBrkKey  |  Return non|zero if the Control|Break key was pressed.        |
  240. +-------------+------------+-------------------+------------------------------+
  241.  
  242.  
  243.   Syntax  int SioBrkKey(void)
  244.  
  245.  Remarks  The  SioBrkKey function  returns  a  TRUE  value  (non-zero)  if  the
  246.           Control-BREAK key was pressed, else it returns a zero.  Use SioBrkKey
  247.           as a safety exit from a polling loop.
  248.  
  249.  Returns  -1 : Control-BREAK was pressed.
  250.            0 : Control-BREAK was NOT pressed.
  251.  
  252. See Also  SioBrkSig
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272. PCL4C Reference Manual                                              Page 4
  273. +-------------+------------------------------------------------------------+
  274. |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.                |
  275. +-------------+------------------------------------------------------------+
  276.  
  277.  
  278.   Syntax  int SioBrkSig(int Port,char Cmd)
  279.           /* Port:  Port selected (COM1 thru COM20) */
  280.           /*  Cmd:  ASSERT ('A'), CANCEL ('C'), or DETECT ('D')*/
  281.  
  282.  Remarks  The SioBrkSig function controls the BREAK  bit  in  the  line  status
  283.           register. The legal commands are:
  284.  
  285.           ASSERT_BREAK ('A') : to assert BREAK
  286.           CANCEL_BREAK ('C') : to cancel BREAK
  287.           DETECT_BREAK ('D') : to detect BREAK
  288.  
  289.           ASSERT_BREAK,  CANCEL_BREAK, and DETECT_BREAK are defined in PCL4C.H.
  290.  
  291.           SioBreak  is often used by one side to signal the other than an error
  292.           condition has occurred.
  293.  
  294.  Returns  -2 : Port not enabled. Call SioReset first.
  295.           -4 : No such port. Expect 0 to MaxPort.
  296.           -6 : Illegal command. Expected 'A', 'C', or 'D'.
  297.           >0 : BREAK signal detected (DETECT command only)
  298.  
  299. See Also  SioBrkKey
  300.  
  301.  
  302.  
  303.  
  304. +-------------+---------------------------------------------------------------+
  305. |   SioCTS    |  Reads the Clear to Send (CTS) modem status bit.              |
  306. +-------------+---------------------------------------------------------------+
  307.  
  308.   Syntax  int SioCTS(int Port)
  309.           /* Port: Port selected (COM1 thru COM20) */
  310.  
  311.  Remarks  The SioCTS function is used to read the Clear  to  Send  (CTS)  modem
  312.           status bit.
  313.  
  314.           The  CTS  line  is  used by some error correcting modems to implement
  315.           hardware flow control.  CTS is dropped by the  modem  to  signal  the
  316.           computer  not  to  send  data and is raised to signal the computer to
  317.           continue.
  318.  
  319.           Refer to the User's Manual for a discussion of flow control.
  320.  
  321.  Returns  -2 : Port not enabled. Call SioReset first.
  322.           -4 : No such port.  Expect 0 to MaxPort.
  323.            0 : CTS is clear.
  324.           >0 : CTS is set.
  325.  
  326. See Also  SioFlow, SioDSR, SioRI, SioDCD, and SioModem.
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. PCL4C Reference Manual                                              Page 5
  341. +-------------+---------------------------------------------------------------+
  342. |   SioDCD    |  Reads the Data Carrier Detect (DCD) modem staus bit.         |
  343. +-------------+---------------------------------------------------------------+
  344.  
  345.  
  346.   Syntax  int SioDCD(int Port)
  347.           /* Port: Port selected (COM1 thru COM20) */
  348.  
  349.  Remarks  The SioDCD function is used to read the  Data  Carrier  Detect  (DCD)
  350.           modem status bit. Also see SioModem.
  351.  
  352.  Returns  -2 : Port not enabled. Call SioReset first.
  353.           -4 : No such port.  Expect 0 to MaxPort.
  354.            0 : DCD is clear.
  355.           >0 : DCD is set.
  356.  
  357. See Also  SioDSR, SioCTS, SioRI, and SioModem.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366. +-------------+---------------------------------------------------------------+
  367. |   SioDelay  |  Delays one or more timer tics.                               |
  368. +-------------+---------------------------------------------------------------+
  369.  
  370.  
  371.   Syntax  int SioDelay(int Tics)
  372.           /* Tics: # timer tics to delay */
  373.  
  374.  Remarks  The SioDelay function is used to delay one or more timer tics,  where
  375.           each  timer  tic  is  approximately 55 milliseconds (18.2 tics to the
  376.           second). Be carefull calling SioDelay since it will not return  until
  377.           the specified delay has occurred.
  378.  
  379.  Returns  zero.
  380.  
  381. See Also  SioTimer
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408. PCL4C Reference Manual                                              Page 6
  409. +-------------+---------------------------------------------------------------+
  410. |   SioDone   |  Terminates further serial processing.                        |
  411. +-------------+---------------------------------------------------------------+
  412.  
  413.  
  414.   Syntax  int SioDone(int Port)
  415.           /* Port: Port selected (COM1 thru COM20) */
  416.  
  417.  Remarks  The  SioDone function terminates further serial  processing.  SioDone
  418.           MUST be called before exiting your application so that interrupts can
  419.           be  restored  to  their original state.  Failure to do this can crash
  420.           the operating system.  If you forget to call SioDone before  exiting,
  421.           be  sure  to  re-boot  your  computer.   You can call SioDone even if
  422.           SioReset has not been called, so it is good practice to  always  call
  423.           SioDone before exiting your application.
  424.  
  425.           Also note that SioDone de-references the transmit and receive buffers
  426.           set  up  by  SioRxBuf  and  SioTxBuf.   However, it does NOT free the
  427.           transmit and receive buffers.   It  is  good  practice  to  free  the
  428.           transmit  and  receive  buffers  (after calling SioDone) if they were
  429.           allocated by malloc (or fmalloc).
  430.  
  431.  Returns  -2 : Port not enabled. Call SioReset first.
  432.           -4 : No such port. Expect 0 to MaxPort.
  433.  
  434. See Also  SioReset.
  435.  
  436.  
  437.  
  438.  
  439. +-------------+---------------------------------------------------------------+
  440. |    SioDSR   |  Reads the Data Set Ready (DSR) modem status bit.             |
  441. +-------------+---------------------------------------------------------------+
  442.  
  443.  
  444.   Syntax  int SioDSR(int Port)
  445.           /* Port: Port selected (COM1 thru COM20) */
  446.  
  447.  Remarks  The  SioDSR function is used to read the Data Set Ready  (DSR)  modem
  448.           status bit. The DSR line is typically used by the serial device (such
  449.           as a modem) to indicate that it is connected.
  450.  
  451.  Returns  -2 : Port not enabled. Call SioReset first.
  452.           -4 : No such port.  Expect 0 to MaxPort.
  453.            0 : DSR is clear.
  454.           >0 : DSR is set
  455.  
  456. See Also  SioCTS, SioRI, SioDCD, and SioModem
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476. PCL4C Reference Manual                                              Page 7
  477. +-------------+---------------------------------------------------------------+
  478. |    SioDTR   |  Set, clear, or read Data Terminal Ready (DTR) status bit.    |
  479. +-------------+---------------------------------------------------------------+
  480.  
  481.  
  482.   Syntax  int SioDTR(int Port,char Cmd)
  483.           /* Port: Port selected (COM1 thru COM20) */
  484.           /* Cmd:  DTR command (SET, CLEAR, or READ) */
  485.  
  486.  Remarks  The SioDTR function controls the Data Terminal Ready (DTR) bit in the
  487.           modem  control  register.   The  DTR  line  is typically used by your
  488.           program to tell the serial device that you are connected. DTR  should
  489.           always  be  set when communicating with a modem. Commands (defined in
  490.           PCL4C.H) are:
  491.  
  492.             SET_LINE ('S') : to set DTR (ON)
  493.           CLEAR_LINE ('C') : to clear DTR (OFF)
  494.            READ_LINE ('R') : to read DTR
  495.  
  496.  Returns  -2 : Port not enabled. Call SioReset first.
  497.           -4 : No such port. Expect 0 to MaxPort.
  498.           -5 : Not one of 'S', 'C', or 'R'.
  499.            0 : DTR is OFF (READ_LINE Command).
  500.           >0 : DTR is ON (READ_LINE Command).
  501.  
  502. See Also  SioRTS.
  503.  
  504.  
  505.  
  506.  
  507.  
  508. +-------------+---------------------------------------------------------------+
  509. |   SioError  |  Displays error in text.                                      |
  510. +-------------+---------------------------------------------------------------+
  511.  
  512.  
  513.   Syntax  int SioError(int Code)
  514.           /* Code: PCL4C error code */
  515.  
  516.  Remarks  The SioError function displays the error in text corresponding to the
  517.           error  code  returned  from a PCL4C function. During development of a
  518.           communications application, it is a good idea to always  test  return
  519.           codes, and print out their descriptions with SioError.
  520.  
  521.  Returns  zero.
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544. PCL4C Reference Manual                                              Page 8
  545. +-------------+---------------------------------------------------------------+
  546. |   SioFIFO   |  Sets the FIFO trigger level (16550 UART only).               |
  547. +-------------+---------------------------------------------------------------+
  548.  
  549.  
  550.   Syntax  int SioFIFO(int Port,int LevelCode)
  551.           /* Port:      Port selected (COM1 thru COM20) */
  552.           /* LevelCode: FIFO level code (see below) */
  553.  
  554.  Remarks  The  SioFIFO  function  is  used to enable both transmit  and receive
  555.           FIFOs for 16550 UARTS, and to set the trigger level at which  receive
  556.           interrupts are generated.
  557.  
  558.           For  example, if the FIFO level is set to 8, then the 16550 UART will
  559.           not generate an interrupt until 8  bytes  have  been  received.  This
  560.           reduces   the  number  of  interrupts  generated  and  allows  faster
  561.           processing with slower machines or when running simultaneous ports.
  562.  
  563.           In order to test if your port is a 16550 UART, call  SioFIFO  with  a
  564.           LevelCode  of other than FIFO_OFF. SioFIFO can be called for the 8250
  565.           and 16450 UART without ill effect.
  566.  
  567.             Code  PCL4C.H Name  Trigger Level
  568.             -1      FIFO_OFF     Disable FIFO
  569.              0      LEVEL_1      1 byte
  570.              1      LEVEL_4      4 bytes
  571.              2      LEVEL_8      8 bytes
  572.              3      LEVEL_14     14 bytes
  573.  
  574.  Returns  -2 : Port not enabled. Call SioReset first.
  575.           -4 : No such port.  Expect 0 to MaxPort.
  576.           >0 : FIFO level set.
  577.            0 : FIFO level not set (not 16550).
  578.  
  579. +------------+----------------------------------------------------------------+
  580. |   SioFlow  |  Sets hardware (RTS/CTS) flow control.                         |
  581. +------------+----------------------------------------------------------------+
  582.  
  583.  
  584.   Syntax  int SioFlow(int Port,int Tics)
  585.           /* Port: Port selected (COM1 thru COM20) */
  586.           /* Tics: # tics before timeout */
  587.  
  588.  Remarks  The SioFlow function is used  to  enable  or  disable  hardware  flow
  589.           control.  Hardware flow control uses RTS and CTS to control data flow
  590.           between the modem and the computer.  Refer to the User's Manual for a
  591.           discussion  of  flow  control.  To enable hardware flow control, call
  592.           SioFlow with Flag >= 0.
  593.  
  594.           "Tics" is the number of timer tics (18.2 per second) before a call to
  595.           SioPutc or SioPuts will time out because CTS was not set.
  596.  
  597.           If you enable hardware flow control, do not modify the RTS  line  (by
  598.           calling SioRTS).
  599.  
  600.           Flow  control  is  disabled  after  resetting  a port.  To explicitly
  601.           disable hardware flow control, call SioFlow with Tics=-1.
  602.  
  603.  Returns  -2 : Port not enabled. Call SioReset first.
  604.           -4 : No such port.  Expect 0 to MaxPort.
  605.           =0 : Flow control disabled.
  606.           >0 : Flow control enabled.
  607.  
  608. See Also  SioPutc and SioPuts
  609.  
  610.  
  611.  
  612. PCL4C Reference Manual                                              Page 9
  613. +------------+----------------------------------------------------------------+
  614. |   SioGetc  |  Reads the next character from the serial line.                |
  615. +------------+----------------------------------------------------------------+
  616.  
  617.  
  618.   Syntax  int SioGetc(int Port,int Tics)
  619.           /* Port: Port selected (COM1 thru COM20) */
  620.           /* Tics: Timeout */
  621.  
  622.  Remarks  The SioGetc function reads a byte from the selected serial port.  The
  623.           function  will wait for the number of system tics given by the 'Tics'
  624.           argument before returning 'timed out'.  There are 18.2  tics  to  the
  625.           second.
  626.  
  627.  Returns  -2 : Port not enabled. Call SioReset first.
  628.           -4 : No such port. Expect 0 to MaxPort.
  629.           -1 : If timed out.
  630.           >0 : Character read.
  631.  
  632. See Also  SioUnGetc and SioPutc.
  633.  
  634.  
  635. +---------------+-------------------------------------------------------------+
  636. |   SioGetDiv   |  Reads the baud rate divisor.                               |
  637. +---------------+-------------------------------------------------------------+
  638.  
  639.  
  640.   Syntax  int SioGetDiv(int Port)
  641.           /* Port: Port selected (COM1 thru COM20) */
  642.  
  643.  
  644.  Remarks  The SioGetDiv function reads the baud rate divisor. The baud rate can
  645.           then be determined from the divisor by using the following table:
  646.  
  647.           Baud   Divisor      Baud  Divisor      Baud  Divisor
  648.            300    0180        4800   0018       38400   0003
  649.           1200    0060        9600   000C       57600   0002
  650.           2400    0030       19200   0006      115200   0001
  651.  
  652.  Returns  -2 : Port not enabled. Call SioReset first.
  653.           -4 : No such port. Expect 0 to MaxPort.
  654.           >0 : Baud rate divisor.
  655.  
  656. See Also  SioParms.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680. PCL4C Reference Manual                                              Page 10
  681. +------------+----------------------------------------------------------------+
  682. |   SioGets  |  Receive a buffer from the serial line.                        |
  683. +------------+----------------------------------------------------------------+
  684.  
  685.  
  686.   Syntax  int SioGets(int Port,char *Buffer,int Length)
  687.           /* Port: Port selected (COM1 thru COM20) */
  688.           /* Buffer: Character buffer */
  689.           /* Length: Length of Buffer (# of requested bytes) */
  690.  
  691.  Remarks  The SioGets function reads bytes from the selected serial port.  This
  692.           function will read either the number of requested bytes or read fewer
  693.           if  no character is immediately available. SioGets cannot return more
  694.           characters than are in the receive buffer at the time it  is  called.
  695.           The number of characters actually read is returned.
  696.  
  697.  Returns  -2 : Port not enabled. Call SioReset first.
  698.           -4 : No such port. Expect 0 to MaxPort.
  699.           -1 : If timed out.
  700.           >0 : Number of characters read into Buffer.
  701.  
  702. See Also  SioUnGetc and SioGetc.
  703.  
  704.  
  705.  
  706.  
  707.  
  708. +-------------+---------------------------------------------------------------+
  709. |   SioInfo   |  Returns PCL4C library information.                           |
  710. +-------------+---------------------------------------------------------------+
  711.  
  712.  
  713.   Syntax  int SioInfo(char Cmd)
  714.           /* Cmd: Command (see below) */
  715.  
  716.  Remarks  The SioInfo function returns a word value depending on the  character
  717.           argument   in   the  table  below.  This  function  is  usefull   for
  718.           understanding  what  the  hardware  is  doing.  Note that the command
  719.           argument is case sensitive.
  720.  
  721.           Info Codes
  722.  
  723.           'V' : Version [as hex byte XY means version X.Y]
  724.           'I' : TRUE if library compiled with TX interrupts enabled.
  725.           'M' : Memory model (0=small,1=compact,2=medium,3=large)
  726.           'P' : TRUE if compiled for protected mode.
  727.           'T' : Total (over all ports) transmitter interrupts.
  728.           'R' : Total (over all ports) receiver interrupts.
  729.           'd' : Total (over all ports) times RTS dropped.
  730.           'r' : Total (over all ports) times RTS raised.
  731.           'c' : Total (over all ports) times CTS drop detected.
  732.  
  733.  Returns   -1 : Function argument not recognized.
  734.           >=0 : Value as per above table.
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748. PCL4C Reference Manual                                              Page 11
  749. +-------------+---------------------------------------------------------------+
  750. |    SioIRQ   |  Assigns an IRQ line to a port.                               |
  751. +-------------+---------------------------------------------------------------+
  752.  
  753.  
  754.   Syntax  int SioIRQ(int Port,intIRQcode)
  755.           /* Port:    Port selected (COM1 thru COM20) */
  756.           /* IRQcode: IRQ number [IRQ2..IRQ15] */
  757.  
  758.  Remarks  The SioIRQ function assigns an IRQ line to a port.  That  is,  SioIRQ
  759.           maps  an  IRQ to a port.  SioIRQ (like SioUART) must be called before
  760.           calling SioReset. Unless you have a non-standard  (COM1  &  COM3  use
  761.           IRQ4  while COM2 & COM4 use IRQ3) serial port configuration (or don't
  762.           want to run more than 2 ports concurrently), you  will  not  need  to
  763.           call  SioIRQ.   Be  EXTREMELY careful with SioIRQ as it can lock your
  764.           machine up if given incorrect information.
  765.  
  766.           In particular, remember that your port  hardware  must  generate  the
  767.           interrupt  that  you have specified.  You should refer to your serial
  768.           board hardware manual for specfic instructions  in  configuring  your
  769.           hardware.  Be sure to call SioPorts first to setup DigiBoard ports if
  770.           you  have  them.   Refer  to  the  PCL4C  Users Manual for additional
  771.           information.
  772.  
  773.  
  774.  Returns  -4 : No such port. Expect 0 to MaxPort.
  775.           15 : Port already enabled.  SioReset has already been called.
  776.          -17 : No such IRQ.
  777.          -18 : ISR limit (maximum of 4 PC IRQs) exceeded.
  778.            0 : Otherwise
  779.  
  780. See Also  SioUART and SioPorts.
  781.  
  782.  
  783.  
  784.  
  785. +-------------+---------------------------------------------------------------+
  786. |   SioLine   |  Reads the line status register.                              |
  787. +-------------+---------------------------------------------------------------+
  788.  
  789.  
  790.   Syntax  int SioLine(int Port)
  791.           /* Port: Port selected (COM1 thru COM20) */
  792.  
  793.  Remarks  The SioLine function reads the line status register.  The  individual
  794.           bit masks are as follows:
  795.  
  796.                0x40  = Transmitter empty.
  797.                0x20  = Transmitter buffer empty.
  798.                0x10  = Break detected.
  799.                0x08  = Framming error.
  800.                0x04  = Parity error.
  801.                0x02  = Overrun error.
  802.                0x01  = Data ready.
  803.  
  804.           The above are documented in the file PCL4C.H.
  805.  
  806.  Returns  -2 : Port not enabled. Call SioReset first.
  807.           -4 : No such port. Expect 0 to MaxPort.
  808.           >0 : Line status (rightmost byte of word).
  809.  
  810. See Also  SioModem.
  811.  
  812.  
  813.  
  814.  
  815.  
  816. PCL4C Reference Manual                                              Page 12
  817. +-------------+---------------------------------------------------------------+
  818. | SioLoopBack |  Does a UART loopback test.                                   |
  819. +-------------+---------------------------------------------------------------+
  820.  
  821.  
  822.   Syntax  int SioLoopBack(int Port)
  823.           /* Port: Port selected (COM1 thru COM20) */
  824.  
  825.  Remarks  SioLoopBack makes use of the built in loopback test capability of the
  826.           INS8250  family  UART.   Normally  SioLoopBack  will never need to be
  827.           called unless you suspect that your UART is bad. Many UARTs  must  be
  828.           reset after running a loopback test.
  829.  
  830.  Returns    0 : Loopback test is successfull.
  831.            -2 : Port not enabled. Call SioReset first.
  832.            -4 : No such port.  Expect 0 to MaxPort.
  833.           -12 : Loopback test fails.
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. +-------------+---------------------------------------------------------------+
  843. |   SioModem  |  Reads the modem status register.                             |
  844. +-------------+---------------------------------------------------------------+
  845.  
  846.  
  847.   Syntax  int SioModem(int Port, int Mask)
  848.           /* Port: Port selected (COM1 thru COM20) */
  849.           /* Mask: Modem function mask */
  850.  
  851.  Remarks  The SioModem function reads the modem register.  The bit  definitions
  852.           for the function mask are as follows:
  853.  
  854.           Bit Name  Function               Bit  Name      Function
  855.            7  DCD   Data Carrier Detect     3   DeltaDCD  DCD has changed
  856.            6  RI    Ring Indicator          2   DeltaRI   RI has changed
  857.            5  DSR   Data Set Ready          1   DeltaDSR  DSR has changed
  858.            4  CTS   Clear To Send           0   DeltaCTS  CTS has changed
  859.  
  860.           Bits 4 through 7 represent the absolute  state  of  their  respective
  861.           RS-232  inputs.   Bits 0 through 3 represent a change in the state of
  862.           their respective RS-232 inputs since last read. Once UART register  3
  863.           is  read, the Delta bits are cleared.  Thus, it is best not to depend
  864.           on the Delta bits.
  865.  
  866.  
  867.  Returns  -2 : Port not enabled. Call SioReset first.
  868.           -4 : No such port. Expect 0 to MaxPort.
  869.           >0 : Modem status (rightmost byte of word).
  870.  
  871. See Also SioCTS, SioDCD, SioDSR and SioRI.
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884. PCL4C Reference Manual                                              Page 13
  885. +-------------+---------------------------------------------------------------+
  886. |  SioParms   |  Sets parity, stop bits, and word length.                     |
  887. +-------------+---------------------------------------------------------------+
  888.  
  889.  
  890.  Syntax   int  SioParms(int Port,int Parity,int StopBits, int DataBits)
  891.           /* Port:     Port selected (COM1 - COM16) */
  892.           /* Parity:   Parity code [0,1,2] */
  893.           /* StopBits: Stop bits code [0,1] */
  894.           /* DataBits: Word length code [0,1,2,3] */
  895.  
  896.  Remarks  The SioParms function sets the parity, stop bits, and word length. If
  897.           the  default  parity (none), stop bits (1), or word length (8) is not
  898.           acceptable, then they can be changed by  calling  SioParms.  SioParms
  899.           can  be  called  either  before  or  after calling SioReset. See file
  900.           PCL4C.H. (8 = default)
  901.  
  902.                         Value   Description    PCL4C.H Name
  903.           ParityCode:    *0      no parity      NoParity
  904.                           1      odd parity     OddParity
  905.                           3      even parity    EvenParity
  906.           StopBitsCode:  *0      1 stop bit     OneStopBit
  907.                           1      2 stop bits    TwoStopBits
  908.           WordLengthCode: 0      5 data bits    WordLength5
  909.                           1      6 data bits    WordLength6
  910.                           2      7 data bits    WordLength7
  911.                          *3      8 data bits    WordLength8
  912.  
  913. Returns   -4 : No such port. Expect 0 to MaxPort.
  914.           -7 : Bad parity code selected. Expecting  0 to 2.
  915.           |8 : Bad stop bits code. Expecting  0 or 1.
  916.           -9 : Bad word length code. Expecting  0 to 3.
  917.  
  918. See Also  SioReset.
  919.  
  920.  
  921. +-------------+---------------------------------------------------------------+
  922. |  SioPorts   |  Sets number of PC & Digiboard / BOCA Board ports.            |
  923. +-------------+---------------------------------------------------------------+
  924.  
  925.  
  926.   Syntax  int  SioPorts(int NbrPorts,int FirstPort,int StatusReg,int Code)
  927.           /* NbrPorts:  Total number of ports */
  928.           /* FirstPort: First DigiBoard port */
  929.           /* StatusReg: DigiBoard Status Register */
  930.           /* Code:      PC_PORTS, DIGIBOARD, or BOCABOARD */
  931.  
  932.  Remarks  The  SioPorts  function  must  be  called  before  ANY  other  serial
  933.           functions.   The purpose of the SioPorts function is to set the total
  934.           number of ports, the first DigiBoard (or BOCA  board)  port  and  the
  935.           DigiBoard (or BOCA board) status register address.
  936.  
  937.           Once SioPorts is called, all COM ports starting with "FirstPort" will
  938.           be  treated as DigiBoard (or BOCA board) ports.  The default setup is
  939.           4  standard  PC  ports   and   no   DigiBoard   or   BOCA   ports   [
  940.           SioPorts(4,4,0,PC_PORTS) ].
  941.  
  942.           Refer to  ther  PCL4C  users  manual  for  more  information  on  the
  943.           DigiBoard   and   BOCA   board.   Many  other  multiport  boards  are
  944.           functionally equivalent to either the DigiBoard or the BOCA board.
  945.  
  946.  Returns  -4 : No such port. Expect 0 to 9.
  947.            0 : No error (sets MaxPort to NumberPorts-1).
  948.  
  949. See Also  SioUART, SioIRQ, and Code Examples.
  950.  
  951.  
  952. PCL4C Reference Manual                                              Page 14
  953. +-------------+---------------------------------------------------------------+
  954. |   SioPutc   |  Transmit a character over a serial line.                     |
  955. +-------------+---------------------------------------------------------------+
  956.  
  957.  
  958.   Syntax  int SioPutc(int Port,char Ch)
  959.           /* Port: Port selected (COM1 thru COM20) */
  960.           /* Ch:   Character to send */
  961.  
  962.  Remarks  The SioPutc function transmits one character over the selected serial
  963.           line.
  964.  
  965.           If  flow control has been enabled, then SioPutc may return a -1 (time
  966.           out) if the number of tics specified  in  the  SioFlow  function  was
  967.           exceeded  waiting  for  the  modem  to raise CTS. Refer to the User's
  968.           Manual for a discussion of flow control.
  969.  
  970.           If  transmitter  interrupts  are enabled, SioPutc returns a -1 if the
  971.           transmit buffer is already full.  Otherewise the byte  is  placed  in
  972.           the  transmit  buffer,  awaiting  transmission by the PCL4C interrupt
  973.           service routine. If transmitter interrupts are not enabled, the  byte
  974.           is loaded directly into the UART transmit buffer.
  975.  
  976.  Returns  -2 : Port not enabled. Call SioReset first.
  977.           -4 : No such port. Expect 0 to MaxPort.
  978.           -1 : Timed out waiting for CTS (flow control enabled), or
  979.                transmit buffer already full.
  980.  
  981. See Also  SioPuts, SioFlow, and SioTxFlush.
  982.  
  983.  
  984.  
  985. +-------------+---------------------------------------------------------------+
  986. |   SioPuts   |  Transmit a buffer over a serial line.                        |
  987. +-------------+---------------------------------------------------------------+
  988.  
  989.  
  990.   Syntax  int SioPuts(int Port,char *Buffer,int Length)
  991.           /* Port: Port selected (COM1 thru COM20) */
  992.           /* Buffer: Character buffer */
  993.           /* Length: Length of Buffer */
  994.  
  995.  Remarks  The  SioPuts  function  transmits  each  buffer  character  over  the
  996.           selected  serial line.  The number of characters actually transmitted
  997.           is returned. This function can take a long time for large buffers  if
  998.           transmitter interrupts are not enabled!
  999.  
  1000.           If  flow  control  has  been enabled, then SioPuts may transmit fewer
  1001.           characters than requested if the number  of  tics  specified  in  the
  1002.           SioFlow  function  was  exceeded  waiting for the modem to raise CTS.
  1003.           Refer to the User's Manual for a discussion of flow control.
  1004.  
  1005.           If transmitter interrupts are enabled, SioPuts  will  transmit  fewer
  1006.           than  the number of characters requested if the transmit buffer would
  1007.           overflow. The actual number of characters transmitted is returned.
  1008.  
  1009.  Returns  -2 : Port not enabled. Call SioReset first.
  1010.           -4 : No such port. Expect 0 to MaxPort.
  1011.           >=0: Number of characters actually transmitted.
  1012.  
  1013. See Also  SioPutc, SioFlow, and SioTxFlush.
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020. PCL4C Reference Manual                                              Page 15
  1021. +-------------+---------------------------------------------------------------+
  1022. |   SioRead   |  Reads any UART register.                                     |
  1023. +-------------+---------------------------------------------------------------+
  1024.  
  1025.  
  1026.   Syntax  int SioRead(int Port,int Reg)
  1027.           /* Port: Port selected (COM1 thru COM20) */
  1028.           /* Reg:  UART register (0 to 7) */
  1029.  
  1030.  Remarks  The  SioReset function directly reads the contents of any  of  the  7
  1031.           UART  registers.   This function is useful when debugging application
  1032.           programs and as a method for verifying UART contents.  Refer  to  the
  1033.           PCL4C Users Manual for a discussion of the 7 UART registers.
  1034.  
  1035.           The line status register (register 5) can also be read  with  SioLine
  1036.           while  the  modem  status register (register 6) can also be read with
  1037.           SioModem.  Refer to the PCL4C User's Manual for a discussion  of  the
  1038.           UART registers.
  1039.  
  1040.  Returns   -3 : No buffer available. Call SioRxBuf first.
  1041.            -4 : No such port. Expect 0 to MaxPort.
  1042.  
  1043. See Also  SioLine and SioModem.
  1044.  
  1045.  
  1046.  
  1047. +-------------+---------------------------------------------------------------+
  1048. |  SioReset   |  Initialize a serial port for processing.                     |
  1049. +-------------+---------------------------------------------------------------+
  1050.  
  1051.  
  1052.   Syntax  int SioReset(int Port,int BaudCode)
  1053.           /* Port:     Port selected (COM1 thru COM20) */
  1054.           /* BaudCode: Baud code or -1 */
  1055.  
  1056.  Remarks  The SioReset function initializes the selected serial port.  SioReset
  1057.           should be called after calling SioParm and SioRxBuf but before making
  1058.           any other calls to PCL4C.  SioReset uses the parity, stop  bits,  and
  1059.           word length value previously set if SioParm was called, otherwise the
  1060.           default values (see SioParm) are used.
  1061.  
  1062.           Recall  that  COM1  and  COM3  share  the  same  interrupt vector and
  1063.           therefore cannot operate simultaneously. Similiarly,  COM2  and  COM4
  1064.           cannot operate simultaneously. Any other combination of two ports can
  1065.           be used.
  1066.  
  1067.           By  specifing  NORESET (-1) for the baud rate code, the port will NOT
  1068.           be  reset.   This  is  used  to  "take  over"  a  port  from  a  host
  1069.           communications   program  that  allows  a  "DOS  gateway".   External
  1070.           protocols can be implemented this way.  See SioBaud for a list of the
  1071.           baud rate codes, or see "PCL4C.H".
  1072.  
  1073.  Returns   -3 : No buffer available. Call SioRxBuf first.
  1074.            -4 : No such port. Expect 0 to MaxPort.
  1075.           -11 : Bad baud rate code selected. Expecting  0 to 9.
  1076.           |13 : UART undefined.  SioUART(Port,0) was called previously.
  1077.           |14 : Bad or missing UART.  You may not have hardware present.
  1078.           |15 : Port already enabled.  SioReset has already been called.
  1079.           -16 : Interrupt already in use.
  1080.  
  1081. See Also  SioBaud, SioParms, SioRxBuf, SioTxBuf, SioDone, and SioUART.
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088. PCL4C Reference Manual                                              Page 16
  1089. +-------------+---------------------------------------------------------------+
  1090. |    SioRI    |  Reads the Ring Indicator (RI) modem status bit.              |
  1091. +-------------+---------------------------------------------------------------+
  1092.  
  1093.  
  1094.   Syntax  int SioRI(int Port)
  1095.           /* Port: Port selected (COM1 thru COM20) */
  1096.  
  1097.  Remarks  The SioRI function is used to read  the  Ring  Indicator  (RI)  modem
  1098.           status bit. Also see SioModem.
  1099.  
  1100.  Returns  -2 : Port not enabled. Call SioReset first.
  1101.           -4 : No such port.  Expect 0 to MaxPort.
  1102.            0 : RI is clear.
  1103.           >0 : RI is set (RING has occurred).
  1104.  
  1105. See Also  SioDSR, SioCTS, SioDCD, and SioModem.
  1106.  
  1107.  
  1108.  
  1109.  
  1110. +-------------+---------------------------------------------------------------+
  1111. |    SioRTS   |  Sets, clears, or reads the Request to Send (RTS) line.       |
  1112. +-------------+---------------------------------------------------------------+
  1113.  
  1114.  
  1115.   Syntax  int SioRTS(Port, char Cmd)
  1116.           /* Port: Port selected (COM1 thru COM20) */
  1117.           /* Cmd:  RTS command (SET, CLEAR, or READ) */
  1118.  
  1119.  Remarks  The  SioRTS  function  controls  the Request to Send  (RTS bit in the
  1120.           modem control register.
  1121.  
  1122.           The  RTS  line  is  used by most error correcting modems to implement
  1123.           hardware flow control.  RTS is dropped by the computer to signal  the
  1124.           modem  not  to  send  data,  and  is  raised  to  signal the modem to
  1125.           continue.  RTS should be set when communicating with a  modem  unless
  1126.           Flow Control is being used.
  1127.  
  1128.           Refer to the User's Manual for a discussion of flow control. Commands
  1129.           (defined in PCL4C.H) are:
  1130.  
  1131.             SET_LINE ('S') : set RTS (ON)
  1132.           CLEAR_LINE ('C') : clear RTS (OFF)
  1133.            READ_LINE ('R') : read RTS
  1134.  
  1135.  Returns  -2 : Port not enabled. Call SioReset first.
  1136.           -4 : No such port. Expect 0 to MaxPort.
  1137.           -5 : Command is not one of 'S', 'C', or 'R'.
  1138.            0 : RTS is OFF (READ_LINE Command).
  1139.           >0 : RTS is ON  (READ_LINE Command).
  1140.  
  1141. See Also  SioFlow and SioDTR.
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156. PCL4C Reference Manual                                              Page 17
  1157. +------------+----------------------------------------------------------------+
  1158. |  SioRxBuf  |  Sets up receive buffers.                                      |
  1159. +------------+----------------------------------------------------------------+
  1160.  
  1161.  
  1162.   Syntax  int SioRxBuf(int Port,int Selector,SizeCode)
  1163.           /* Port:     Port selected (COM1 thru COM20) */
  1164.           /* Selector: Receive buffer segment [selector for PM] */
  1165.           /* SizeCode: Buffer size code */
  1166.  
  1167.  Remarks  The SioRxBuf function passes the address  segment  and  size  of  the
  1168.           receive buffer to PCL4C.  Recall that PCL4C requires a receive buffer
  1169.           for each port in simultaneous operation since the receive function is
  1170.           interrupt  driven.   It must be called before any incoming characters
  1171.           can be received. SioRxBuf must be  called  before  SioReset.   Buffer
  1172.           size codes are listed in "PCL4C.H".
  1173.  
  1174.           Size Code       Buffer Size    PCL4C.H Name
  1175.              4            128 bytes        Size128
  1176.              5            256 bytes        Size256
  1177.              6            512 bytes        Size512
  1178.              7           1024 bytes        Size1024 or Size1K
  1179.              8           2048 bytes        Size2048 or Size2K
  1180.              9           4096 bytes        Size4096 or Size4K
  1181.             10           8192 bytes        Size8192 or Size8K
  1182.             11          16384 bytes        Size16384 or Size16K
  1183.             12          32768 bytes        Size32768 or Size32K
  1184.  
  1185.  Returns  -4 : No such port. Expect 0 to MaxPort.
  1186.           -10 : Bad buffer size code. Expecting 0 to 11.
  1187.  
  1188. See Also  SioReset, SioTxBuf and Code Examples.
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194. +------------+----------------------------------------------------------------+
  1195. | SioRxClear |  Cleares (clears) the receive buffer.                          |
  1196. +------------+----------------------------------------------------------------+
  1197.  
  1198.  
  1199.   Syntax  int SioRxClear(int Port)
  1200.           /* Port: Port selected (COM1 thru COM20) */
  1201.  
  1202.  Remarks  The  SioRxClear  function  will  delete any characters in the receive
  1203.           buffer for the specified port.  After execution, the  receive  buffer
  1204.           will  be  empty.   Call  SioRxBuf  after resetting a port in order to
  1205.           delete any spurious characters.
  1206.  
  1207.  Returns  -2 : Port not enabled. Call SioReset first.
  1208.           -4 : No such port. Expect 0 to MaxPort.
  1209.  
  1210. See Also  SioRxQue.
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224. PCL4C Reference Manual                                              Page 18
  1225. +-------------+---------------------------------------------------------------+
  1226. |  SioRxQue   |  Returns the number of bytes in the receive queue.            |
  1227. +-------------+---------------------------------------------------------------+
  1228.  
  1229.  
  1230.   Syntax  int SioRxQue(int Port)
  1231.           /* Port: Port selected (COM1 thru COM20) */
  1232.  
  1233.  Remarks  The SioRxQue function will return the number  of  characters  in  the
  1234.           receive  queue  at  the time of the call. It can be used to implement
  1235.           XON/XOFF flow control.
  1236.  
  1237.  Returns  -2 : Port not enabled. Call SioReset first.
  1238.           -4 : No such port. Expect 0 to MaxPort.
  1239.  
  1240. See Also   SioRxClear.
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249. +------------+----------------------------------------------------------------+
  1250. |  SioTimer  |  Returns the number of system clock tics since midnight.       |
  1251. +------------+----------------------------------------------------------------+
  1252.  
  1253.  
  1254.   Syntax  long SioTimer(void)
  1255.  
  1256.  Remarks  The SioTimer function will return the number  of  system  clock  tics
  1257.           since midnight, at 18.2065 tics per second.  This function is usefull
  1258.           for timing various functions.
  1259.  
  1260. See Also  SioDelay
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292. PCL4C Reference Manual                                              Page 19
  1293. +------------+----------------------------------------------------------------+
  1294. |  SioTxBuf  |  Sets up transmitter buffer.                                   |
  1295. +------------+----------------------------------------------------------------+
  1296.  
  1297.  
  1298.   Syntax  int SioTxBuf(int Port,int Selector,int SizeCode)
  1299.           /* Port:     Port selected (COM1 thru COM20) */
  1300.           /* Selector: Receive buffer segment [selector in PM] */
  1301.           /* SizeCode: Buffer size code */
  1302.  
  1303.  Remarks  The SioTxBuf function passes the address  segment  and  size  of  the
  1304.           transmit  buffer  to  PCL4C, provided that you will link with a PCL4C
  1305.           library with transmitter  interrupts  enabled.   SioTxBuf()  must  be
  1306.           called before SioReset.
  1307.  
  1308.           Size Code       Buffer Size    PCL4C.H Name
  1309.              4            128 bytes        Size128
  1310.              5            256 bytes        Size256
  1311.              6            512 bytes        Size512
  1312.              7           1024 bytes        Size1024 or Size1K
  1313.              8           2048 bytes        Size2048 or Size2K
  1314.              9           4096 bytes        Size4096 or Size4K
  1315.             10           8192 bytes        Size8192 or Size8K
  1316.             11          16384 bytes        Size16384 or Size16K
  1317.             12          32768 bytes        Size32768 or Size32K
  1318.  
  1319.  Returns   -4 : No such port. Expect 0 to MaxPort.
  1320.           -10 : Bad buffer size code. Expecting 0 to 11.
  1321.  
  1322. See Also  SioRxBuf, SioReset and Code Examples.
  1323.  
  1324.  
  1325. +------------+----------------------------------------------------------------+
  1326. | SioTxClear |  Cleares (clears) the transmitter buffer.                      |
  1327. +------------+----------------------------------------------------------------+
  1328.  
  1329.  
  1330.   Syntax  int SioTxClear(int Port)
  1331.           /* Port: Port selected (COM1 thru COM20) */
  1332.  
  1333.  Remarks  The SioTxClear function will delete any characters  in  the  transmit
  1334.           buffer  for  the  specified  port, provided that you will link with a
  1335.           PCL4C library with transmitter interrupts enabled.  After  execution,
  1336.           the transmit buffer will be empty.
  1337.  
  1338.           Once this function is called, any character in  the  transmit  buffer
  1339.           (put  there  by  SioPutc) will be lost and therefore not transmitted.
  1340.           This function is not  used  unless  the  transmitter  interrupts  are
  1341.           enabled   Refer   to  the  PCL4C  Users  Manual  for  information  on
  1342.           transmitter (TX) interrupts.
  1343.  
  1344.  Returns  -2 : Port not enabled. Call SioReset first.
  1345.           -4 : No such port. Expect 0 to MaxPort.
  1346.  
  1347. See Also  SioTxFlush and SioTxQue.
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360. PCL4C Reference Manual                                              Page 20
  1361. +------------+----------------------------------------------------------------+
  1362. | SioTxFlush |  Flushes the transmitter buffer.                               |
  1363. +------------+----------------------------------------------------------------+
  1364.  
  1365.  
  1366.   Syntax  int SioTxFlush(int Port)
  1367.           /* Port: Port selected (COM1 thru COM20) */
  1368.  
  1369.  Remarks  The SioTxFlush function will re-enable transmitter interrupts if they
  1370.           had been disabled by CTS dropping. This has the effect of forcing all
  1371.           data out of the transmitter queue unless stopped again by  CTS  going
  1372.           down.
  1373.  
  1374.           Once the transmitter interrupt has been disabled (by CTS going down),
  1375.           then the only way to restart it is by calling one of the  serial  I/O
  1376.           functions  (SioPutc,  SioPuts,  SioGetc,  or  SioGets),  SioTxQue, or
  1377.           SioTxFlush.
  1378.  
  1379.           The primary purpose of SioTxFlush is to provide an explicit means  of
  1380.           restarting  transmitter  interrupts.
  1381.  
  1382.  Returns  -2 : Port not enabled. Call SioReset first.
  1383.           -4 : No such port. Expect 0 to MaxPort.
  1384.  
  1385. See Also  SioTxQue.
  1386.  
  1387.  
  1388.  
  1389. +------------+----------------------------------------------------------------+
  1390. |  SioTxQue  |  Returns the number of bytes in the transmit queue.            |
  1391. +------------+----------------------------------------------------------------+
  1392.  
  1393.  
  1394.   Syntax  int SioTxQue(int Port)
  1395.           /* Port: Port selected (COM1 thru COM20) */
  1396.  
  1397.  Remarks  The SioTxQue function will return the number  of  characters  in  the
  1398.           transmit  queue  at the time of the call, provided that you will link
  1399.           with a PCL4C library with transmitter interrupts enabled.
  1400.  
  1401.           This function is not  used  unless  the  transmitter  interrupts  are
  1402.           enabled.   Refer  to  the  PCL4C  Users  Manual  for  information  on
  1403.           transmitter (TX) interrupts.
  1404.  
  1405.  Returns  -2 : Port not enabled. Call SioReset first.
  1406.           -4 : No such port. Expect 0 to MaxPort.
  1407.  
  1408. See Also  SioTxFlush.
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428. PCL4C Reference Manual                                              Page 21
  1429. +------------+----------------------------------------------------------------+
  1430. |  SioUART   |  Sets the UART base address.                                   |
  1431. +------------+----------------------------------------------------------------+
  1432.  
  1433.  
  1434.   Syntax  int SioUART(int Port,int Address)
  1435.           /* Port:    Port selected (COM1 thru COM20) */                           int Port;     /* COM1 to COM4 */
  1436.           /* Address: UART address */
  1437.  
  1438.  Remarks  The SioUART function sets the UART base  address  for  the  specified
  1439.           port.   SioUART  must  be  called  before  SioReset  in order to have
  1440.           effect.  Be extremely sure that you know what you  are  doing!   Note
  1441.           that  PCL4C  uses  the  standard  PC/XT/AT  port addresses, interrupt
  1442.           request  lines,  and  interrupt  service  vectors.   Therefore,  this
  1443.           function is only needed for non-standard ports.
  1444.  
  1445.  Returns  >0 : The previous base address for this port.
  1446.           -4 : No such port.  Expect 0 to MaxPort.
  1447.          -15 : Port already enabled.  SioReset has already been called.
  1448.  
  1449. See Also  SioPorts, SioIRQ, and SioReset.
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455. +------------+-----+----------------------------------------------------------+
  1456. | SioUnGetc  |  "Un|gets" the last character read with SioGetc().             |
  1457. +------------+-----+----------------------------------------------------------+
  1458.  
  1459.  
  1460.   Syntax  int SioUnGetc(int Port,char Ch)
  1461.           /* Port: Port selected (COM1 thru COM20) */
  1462.           /* Ch:   Character to unget */
  1463.  
  1464.  Remarks  The SioUnGetc function returns ("pushes") the character back into the
  1465.           serial input buffer.  The character pushed will be the next character
  1466.           returned  by  SioGetc.   Only  one character can be pushed back. This
  1467.           function works just like the "ungetc" function in the C language.
  1468.  
  1469.  Returns  -2 : Port not enabled. Call SioReset first.
  1470.           -4 : No such port. Expect 0 to MaxPort.
  1471.  
  1472. See Also  SioReset.
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496. PCL4C Reference Manual                                              Page 22
  1497.                     Function Sumary
  1498.  
  1499.  
  1500.  
  1501. +-------------+----------+----------+----------+----------+
  1502. | Function    |   Arg1   |   Arg2   |   Arg3   |   Arg4   |
  1503. +-------------+----------+----------+----------+----------+
  1504. | SioBaud     | Port     | BaudCode |          |          |
  1505. | SioBrkKey   |          |          |          |          |
  1506. | SioBrkSig   | Port     | Cmd      |          |          |
  1507. | SioCTS      | Port     |          |          |          |
  1508. | SioDCD      | Port     |          |          |          |
  1509. | SioDelay    | Tics     |          |          |          |
  1510. | SioDone     | Port     |          |          |          |
  1511. | SioDSR      | Port     |          |          |          |
  1512. | SioDTR      | Port     | Cmd      |          |          |
  1513. | SioError    | Code     |          |          |          |
  1514. | SioFIFO     | Port     | LevelCode|          |          |
  1515. | SioFlow     | Port     | Tics     |          |          |
  1516. | SioGetc     | Port     | Tics     |          |          |
  1517. | SioGetDiv   | Port     |          |          |          |
  1518. | SioGets     | Port     | Buffer   | Length   |          |
  1519. | SioInfo     | Cmd      |          |          |          |
  1520. | SioIRQ      | Port     | IRQcode  |          |          |
  1521. | SioLine     | Port     |          |          |          |
  1522. | SioLoopBack | Port     |          |          |          |
  1523. | SioModem    | Port     | Mask     |          |          |
  1524. | SioParms    | Port     | Parity   | StopBits | DataBits |
  1525. | SioPorts    | NbrPorts | FirstPort| StatusReg| Code     |
  1526. | SioPutc     | Port     | Ch       |          |          |
  1527. | SioPuts     | Port     | Buffer   | Length   |          |
  1528. | SioRead     | Port     | Reg      |          |          |
  1529. | SioReset    | Port     | BaudCode |          |          |
  1530. | SioRI       | Port     |          |          |          |
  1531. | SioRTS      | Port     | Cmd      |          |          |
  1532. | SioRxBuf    | Port     | Segment  | SizeCode |          |
  1533. | SioRxClear  | Port     |          |          |          |
  1534. | SioRxQue    | Port     |          |          |          |
  1535. | SioTimer    |          |          |          |          |
  1536. | SioTxBuf    | Port     | Segment  | SizeCode |          |
  1537. | SioTxClear  | Port     |          |          |          |
  1538. | SioTxFlush  | Port     |          |          |          |
  1539. | SioTxQue    | Port     |          |          |          |
  1540. | SioUART     | Port     | Address  |          |          |
  1541. | SioUnGetc   | Port     | Ch       |          |          |
  1542. +-------------+----------+----------+----------+----------+
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564. PCL4C Reference Manual                                              Page 23
  1565.                     Error Code Summary
  1566.  
  1567.  
  1568.  
  1569. +------+--------------------------------------------------------+
  1570. | Code |  Description                                           |
  1571. +------+--------------------------------------------------------+
  1572. |   0  |  No error.                                             |
  1573. |  -1  |  Timeout waiting for I/O.                              |
  1574. |  |2  |  Port not enabled. Call SioReset first.                |
  1575. |  |3  |  No buffer available. Call SioRxBuf first.             |
  1576. |  |4  |  No such port. Expect 0 to MaxPort. (COM1 = 0)         |
  1577. |  |5  |  Expected 'S', 'C', or 'R' as 2nd argument.            |
  1578. |  |6  |  Expected 'A', 'C', or 'D' as 2nd argument.            |
  1579. |  |7  |  Bad parity code specified. Expected 0 to 7.           |
  1580. |  |8  |  Bad stop bits code specified. Expected 0 or 1.        |
  1581. |  -9  |  Bad wordlength code specified. Expect 0 to MaxPort.   |
  1582. | -10  |  Bad buffer size code specified. Expected 0 to 11.     |
  1583. | |11  |  Bad baud rate code. Expected 0 to 9.                  |
  1584. | |12  |  Loopback test fails.                                  |
  1585. | |13  |  UART undefined.                                       |
  1586. | |14  |  Missing or bad UART. (no UART hardware ?)             |
  1587. | |15  |  Port already enabled.                                 |
  1588. | |16  |  ISR (interrupt) already in use.                       |
  1589. | |17  |  No such IRQ. (Should be 2 to 7)                       |
  1590. | |18  |  ISR limit (maximum of 4 PC IRQs) exceeded.            |
  1591. | |19  |  Shareware screen cannot be displayed.                 |
  1592. +-+----+--------------------------------------------------------+
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632. PCL4C Reference Manual                                              Page 24
  1633.                        Code Examples
  1634.  
  1635.  
  1636.  
  1637. SioRxBuf / SioTxBuf Example
  1638.  
  1639.  
  1640. int BufSize = 1024;
  1641. int SizeCode = Size1024;
  1642. char far *Ptr;
  1643. int BufSeg;
  1644. ...
  1645. /* allocate receive buffer + 16 bytes */
  1646. Ptr = (char far *) _fmalloc(BufSize+16);
  1647. BufSeg = FP_SEG(Ptr) + ((FP_OFF(Ptr)+15)>>4);
  1648. /* pass receive buffer segment to PCL4C */
  1649. SioRxBuf(Port,BufSeg,SizeCode);
  1650. /* allocate transmit buffer + 16 bytes */
  1651. Ptr = (char far *) _fmalloc(BufSize+16);
  1652. BufSeg = FP_SEG(Ptr) + ((FP_OFF(Ptr)+15)>>4);
  1653. /* pass transmit buffer segment to PCL4C */
  1654. SioTxBuf(Port,BufSeg,SizeCode)
  1655.  
  1656.  
  1657. DigiBoard Example
  1658.  
  1659.  
  1660. /* use 0x140 for odd IRQs & 0x141 for even IRQs */
  1661. SioPorts(8,COM1,0x140,DIGIBOARD);
  1662. for(i=COM1;i<=COM8;i++)
  1663.   {/* set DigiBoard UART addresses */
  1664.    SioUART(i,0x100+8*i);
  1665.    /* set DigiBoard for IRQ5 */
  1666.    SioIRQ(i,IRQ5);
  1667.   }
  1668.  
  1669.  
  1670. BOCA Board Example
  1671.  
  1672.  
  1673. /* use base port + 7 */
  1674. SioPorts(16,COM1,0x100+7,BOCABOARD);
  1675. for(i=COM1;i<=COM16;i++)
  1676.   {/* set BOCA Board UART addresses */
  1677.    SioUART(i,0x100+8*i);
  1678.    /* set DigiBoard for IRQ5 */
  1679.    SioIRQ(i,IRQ5);
  1680.   }
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700. PCL4C Reference Manual                                              Page 25
  1701.