                  PUREC Librarie for Devices access

                             DEVICE2.LIB

                             Release V2.0
                          20. Dezember 1998

                                  by

                    Jan Kriesten/Olivier Booklage


Contents
========

 1  Introduction

 2  Copyright

 3  Disclaimer

 4  Description

 5  Trailer

 6  History

 7  Authors



1  Introduction
***************

It's the same everytime. You write a program and have to write parts
of it other programmers have written long time ago for themselves,
too.

That was the same for me, too. I was to be writing a new fidonet
mailer and had to do a lot of research to design all the port i/o
routines which were written by other authors before. Also, the
different device drivers (HSModem, FastSerial, ...) needed different
support. In fact I wished there had been a couple of routines which
would have made my life easier.

This is the reason I give this library to public. The library contains
many useful i/o routines for using the ports of your atari. Also it's
supporting HSModem and MiNT block device drivers as well as
FastSerial.



2  Copyright
************

Copyright (c) 1994, 1995 by Jan Kriesten (c) 1998 by Olivier Booklage

Please notice that the library is not 'public domain' or 'freeware',
but it's allowed to spread it out (without charging fees) via public
BBS or public networks like FidoNet. In any case the original archive
has to be spread out and must not be modified.

It's not allowed to make this library available via other channels
like pd disk series, cd rom's or channel videodat.

Using this library in commercial/shareware programs is only allowed
with permission of the author.



3  Disclaimer
*************

Every care is taken to ensure that these routines are bug free and
will not cause any trouble on your system.

However, I take no responsibility for any harm that may occur to your
system by using this library.



4  Description
**************

The library is designed to be used together with PureC. To use the
routines you just have to move device.h and device.lib to the corres-
ponding include/library folder of PureC and add device.lib to your
project file.

Please notice that if you're running MiNT without HSModem or
FastSerial started after it in the `Auto' folder, the device library
changes to the MiNT process execution domain to handle device-I/O in a
correct way. That means to you that Fread/Fwrite will follow the
terminal settings (which needs not to be 'RAW' mode!) - actually I
don't know if this is only valid for devices or also for files. Also
filenames returned by Fsfirst/Fsnext may be treated differently, i.e.
differencing between upper/lower case or filenames longer than 8+3
characters. This can also effect programs started by yours via
Pexec()!

The following routines are available. Please refer to the file
device.h for further descriptions:


  DEV_LIST *InitDevices ( VOID *pause_normal, VOID *pause_super );
  VOID     TermDevices  ( VOID );
  BOOLEAN  OpenDevice   ( DEV_LIST *port );
  VOID     CloseDevice  ( DEV_LIST *port );
  VOID     PortParameter( DEV_LIST *port, UWORD flowctl, UWORD charlen, UWORD stopbits, UWORD parity );
  WORD     GetBiosNr    ( DEV_LIST *port );
  LONG     *GetSpeedList( DEV_LIST *port );
  LONG     SetDTESpeed  ( DEV_LIST *port, LONG speed );

  BOOLEAN  PortSendByte ( DEV_LIST *port, BYTE c );
  BOOLEAN  PortSendBlock( DEV_LIST *port, BYTE *block, LONG len, BOOLEAN tst_dcd );
  WORD     PortGetByte  ( DEV_LIST *port );
  WORD     PortPeekByte ( DEV_LIST *port );

  BOOLEAN  OutIsEmpty   ( DEV_LIST *port );
  BOOLEAN  WaitOutEmpty ( DEV_LIST *dev, BOOLEAN tst_dcd, UWORD wait_hundreds );
  BOOLEAN  CharAvailable( DEV_LIST *port );
  VOID     ClearIOBuffer( DEV_LIST *port, LONG which );

  VOID     DtrOn        ( DEV_LIST *port );
  VOID     DtrOff       ( DEV_LIST *port );
  BOOLEAN  IsCarrier    ( DEV_LIST *port );
  VOID     StartReceiver( DEV_LIST *port );
  VOID     StopReceiver ( DEV_LIST *port );

  WORD     SetRxBuffer  ( DEV_LIST *port, WORD size );
  WORD     GetRxBuffer  ( DEV_LIST *port );
  WORD     SetTxBuffer  ( DEV_LIST *port, WORD size );
  WORD     GetTxBuffer  ( DEV_LIST *port );

  VOID     get_tos      ( WORD *tos );
  BOOLEAN  getcookie    ( LONG cookie, LONG *value );
  ULONG    Get200Hz     ( VOID );
  ULONG    Calc200Hz    ( ULONG time_to_set );




5  Trailer
**********

This library will be supported - or not. This is depending on how many
people are using - and supporting - this library. If you like this
library and you're using it in your own programs you should think of
making a donation for it. Any donation is welcome and will increase my
motivation of supporting it further.

My bank account:

Jan Kriesten, Citibank Kto.-Nr. 0910680784 BLZ 300 209 00

Any suggestions or bug reports please send to any of the above EMail
adresses.



6  History
**********

* V2.0 *

-Modified for no force any flow control by default for OpenDevice() so
Modem 1, Modem 2 ... are not forced with RTS/CTS and Midi Xon/Xoff. It
was very bad for some programs using Midi device as dialer.app for
STinG by Peter Rottengatter.

-Modified for true testing IsCarrier() if port is busy or not



7  Authors
**********


     | Jan Kriesten                                             |
     | Wunderburggasse 3                                        |
     | 90403 Nrnberg                                           |
     | Germany                                                  |
     | Maus: Maus F                                            |
     | NeST: 90:400/1002@nest.ftn                               |
     | AtariNet: 51:601/103@atarinet.ftn                        |
     | FidoNet: 2:2490/1624@fidonet.org                         |
     | email : an@grundigmm.de                                  |
     | email : kriesten@mailer.uni-marburg.de                   |
     | Olivier Booklage                                         |
     | 4, cours des longs prs                                  |
     | 92100 Boulogne Billancourt                               |
     | France.                                                  |
     | email : res1@vcf-com.fr                                  |
     | www   : http://services.worldnet.net/vcf-com/olivier.htm |
