PAMSDMA.XIF (C) 1995-1999 by T. Lang

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!PLEASE READ THE WHOLE DOCUMENT BEFORE USING THIS DRIVER!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The driver for PAM's DMA adaptor is based on dummyeth from Kay Roemer, the DMA
code (C) T. Lang.

There are some important things to know, so READ THIS BEFORE USING:
- Starting and stopping the DMA adaptor with ifconfig up or down doesn't work
  quite reliable yet. So better let the interface be up after configuring.
- It is important that a harddisk driver checks the FLOCK flag itself before
  beginning its work. At least some drivers like HUSHI don't and are NOT
  recommended for use together with these drivers!!!
- Be careful with background DMA drivers like the floppy driver or some special
  harddisk drivers. The protective protocol has been changed for their use:
  - when sending:
    Check for FLOCK, if set -> queue packet
  - interrupt routine:
    Check FLOCK, if set -> quit, else check for queued send packets, dequeue
    and send them, then check for received packets, if any get them and pass
    them to the upper layers.
  So before testing any background DMA stuff you should make a backup of your
  harddisk! This driver was tested together with my background DMA driver for
  my harddiskrecording interface and works quite stable (depending on the
  CPU and DMA bus load).
- Floppy access causes massive delays in sending and receiving!
- 1. Kay told me that MiNT doesn't do any task switches when FLOCK is set.
  2. I read in the MiNT documentation that MiNT doesn't do any task switches
     when the processor is in supervisor state.
  3. Usual harddisk drivers do DMAs in supervisor mode.
  The PAMSDMA driver relies on these facts. I would have written a completely
  interrupt driven DMA code (like I've done for my harddsikrecording system
  for ALL STs working on the ACSI port) but that's a lot of work due to some
  problems with dirty harddisk drivers like HUSHI ignoring a set FLOCK flag.
  Otherwise the scheme would be as follows in the interrupt routine:

  - DMA running?
  - If no
  -    check if FLOCK set
  -    if no
  -       check if any packets received
  -          if yes start read DMA, set FLOCK
  -       else
  -          check if any send packets queued
  -          if yes dequeue packet and store it DMA buffer, start write DMA
  - else
  -    check if INT line low
  -    if yes
  -       read DMA?
  -          pass received packet to upper layers
  -       get status byte, clear FLOCK

Planned features:
- It should be possible that one PAMSDMA.XIF manages more than one DMA
  adaptor. At the moment you can use only one.
- If someone passes me complete documentation about the PAM's DMA adaptors
  it would be possible to add IOCTLs for setting the DMA address and the boot
  behaviour of the adaptor.
- Error management is missing due to missing documentation.
  Please notice: I've done the code without any documentation about the adaptor.
  The original code used in PAM's software was so ugly that I didn't use it
  as a help.

ATTENTION:
As a replacement for cache management I've used another trick in this release
of the driver:
The DMA buffer is accessed only at a mirrored address. The address is
ORed with $FF000000 so that the buffer is accessed in an uncached area.
The only drawback with this trick is that it works DEFINITELY NOT on machines
with real 32 bit adressing without patching the MMU tables. This means that it
works not on the Atari TT and perhaps also will cause trouble on the Eagle or
the Medusa since AFAIK they don't mirror the ST RAM.
If you want to use this driver on one of these machines please use an
older version of the driver. Well, the driver SHOULD work on tuned STs like
the MEGA ST + PAK/3 + FRAK. It works at least on my tuned MEGA...

I didn't get any help for the development of this driver although M. Völkel
from GK Computer promised me to send me the documentation for the adaptor.
That was more than one year ago :-/
 
DON'T TRY THESE DRIVERS UNLESS YOU ARE ABSOLUTELY SURE WHAT YOU ARE DOING.
I'm not responsible for any crashed harddisk or so.

SPECIAL OPTIONS
None

If you have any suggestions, flames, hints or so do not hesitate to contact me.
My address:
Torsten Lang
Bismarckstr. 6
35410 Hungen
EMail: Torsten@Lang.net
