Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telepathy Communications Library - <b>tp_fifo()</b> - get or set 16550 fifo state http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_fifo() - get or set 16550 FIFO state

   nOldFIFO := tp_fifo(nPort, [nNewFIFO])

   nPort       Serial port number.
   nNewFIFO    New FIFO state.

   Returns     0 or 1, depending on whether the FIFO was enabled.

   Gets or sets the state of the transmit/receive FIFO buffers on a
   16550 UART.  These buffers allow a 16550 to work at higher baud rates
   than a conventional UART, especially when running a multi-tasking
   operating system or DOS shell such as DESQview or Microsoft Windows.

   The 16550 has a pair of internal 16-byte FIFO (first-in, first-out)
   buffers, one for data being transmitted and the other for received
   data.  When the FIFOs are enabled, the UART can buffer incoming data
   if the computer is not ready to accept them.  The FIFOs are enabled
   or disabled by setting nNewFIFO, the buffer "trip point".  If
   nNewFIFO is 0, the FIFOs are disabled.  If nNewFIFO is 1, 2, 3, or 4,
   the FIFOs are enabled and the trip point is set to 1, 4, 8, or 14
   characters respectively.  Normally, you would set nNewFIFO to 0 or 1;
   use other values only if you are familiar with the internal workings
   of the 16550 UART.

   If nNewFIFO is omitted, tp_fifo() just returns the current trip point
   setting.  If nNewFIFO is specified, it changes the setting and
   returns the original value.  It is not possible to tell where the
   FIFO's trip point is set, but only whether it is enabled or disabled,
   so tp_fifo() will only return 0 or 1.

   Note: Some other communication software will not work correctly with
   a 16550 with its FIFOs enabled, so it is a good idea to disable the
   FIFOs when your program exits.

   Examples:

       tp_fifo(1, 1)       // Enable FIFOs on port 1.

       // This function returns .T. if the port has a 16550, .F. if not.
       // It does not change the FIFO enabled state.

       function Has16550(nPort)
           if tp_fifo(nPort) != 0
               return .T.
           endif

           tp_fifo(nPort, 1)

           if tp_fifo(nPort) != 0
               tp_fifo(nPort, 0)
               return .T.
           endif

           return .F.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson