[comp.sys.apollo] DMA on DN4000 AT-bus

WWDONIC@HEITUE5.BITNET (01/03/90)

We have a measurement system that produces a continuous stream
of 16-bit parallel data (about 20k words per second).  Each valid
word is accompanied by a strobe.

This system has to be interfaced to an Apollo DN4000 in such a way
that all data generated during a fixed period of, say, 10 seconds
can be stored on a disk file.  The idea is to use an AT-bus parallel
IO card and the DN4000 DMA controller for this purpose.  The DN4000
is running OS version 9.6.1 and GPIO has been installed.

Before starting this project, I need answers to these questions:

1. Has anyone done a similar thing before?  The Apollo people here
can only say "it should be possible", and don't give any specific
examples.

2. The example provided with GPIO (floppy driver) does not deal with
a continuous stream of data; the floppy controller stops sending data
after each sector (512 bytes).  Is it possible to read in a much larger
amount of data (400k) without losing anything ?

3. Do I have to upgrade the OS ?

Please reply directly to me, I'll summarize for the list.

Ton van den Bogert
Dept. of Veterinary Anatomy
University of Utrecht, The Netherlands.
E-mail: WWDONIC@HEITUE5.BITNET

krowitz%richter@UMIX.CC.UMICH.EDU (David Krowitz) (01/04/90)

It should be possible to do if you can wire (lock into physical
memory) and map a large enough I/O buffer to hold the entire
stream of data. I have wired buffers of up to 128Kb under SR10.
I don't know what the limit would be under SR9.6, you'll have
to try it. You'll have to use a single buffer for the entire
transfer, since at 20K words/sec you only have 0.5 msec 
between transfers. That it not enough time to wire and map
a second buffer. The sequence of calls you want to use would
be something like:


   	pbu_$aquire (device_name, name_len, debug_flg, unit_num, status)

	pbu_$allocate_map (unit, length_of_buffer, force_flag, I/O_vir_addr, status)

	pbu_$map (unit, big_buffer, length_of_buffer, I/O_vir_addr, status)

	pbu_$wire (unit, big_buffer, length_of_buffer, status)

	set dma-enable, interrupt-enable on interface board

	pbu_$dma_start (unit, dma_channel_from_ddf_blk, pbu_$read, buffer,length_of_buffer, option, status);

	pbu_$wait (unit, timeout, quit_flg, status);

	pbu_$dma_stop (unit, dma_channel, status)

	clear dma-enable, interrupt-enable on interface board

	pbu_$unwire (unit, buffer, length_of_buffer, flag, status)

	pbu_$unmap (unit, buffer, length, I/O_vir_addr, status);

	pbu_$free_map ( unit, status)


 -- David Krowitz

krowitz@richter.mit.edu   (18.83.0.109)
krowitz%richter.mit.edu@eddie.mit.edu
krowitz%richter.mit.edu@mitvma.bitnet
(in order of decreasing preference)

lampi@pnet02.gryphon.com (Michael Lampi) (01/05/90)

>1. Has anyone done a similar thing before? [rest deleted for brevity]

Yes, I have written a couple of DN-x0x0 device drivers that do similar things,
including one that had to read up to 10 megabytes of data nonstop coming at a
data rate of up to a megabyte per second. This was in order to read tape
records that were written in the seismic form; i.e., tape blocks that were
megabytes in length; where one can not just 'stop the tape and hold it in
position' until the Apollo is ready for more.

>2. [...deleted] Is it possible to read in a much larger
>amount of data (400k) without losing anything ?

Yes, depending on your controller, your driver code, and the amount of RAM in
your Apollo. You see, the controller or the thing it is attached to must
either have a FIFO memory or be able to be re-instructed to transfer more data
within .05 milliseconds to achieve the 20,000 data transfers per second rate.
The Apollo interrupt mechanism can generally meet this constraint if you don't
have anything else occurring on the node with a higher interrupt priority,
such as network or disk access. (That's where a FIFO is handy!)

The amount of RAM you have comes into play when you realize that the operating
system requires about 1 megabyte (round numbers), your application code and
stack requires (typically) 1/2 megabyte, etc. I forget what the general rule
of thumb is, but it goes something like this:
   You can wire all the RAM in your system except for about 2 megabytes, which
is allocated to the OS.

So, in an 8 meg system, you can wire up to a 6 meg buffer.

>7. Do I have to upgrade the OS ?

I would strongly recommend you upgrade to 9.7.5; however, this should still
work on 9.6.1.

Michael Lampi               MDL Corporation   213/782-7888   fax 213/782-7927

UUCP: {ames!elroy, <routing site>}!gryphon!pnet02!lampi
INET: lampi@pnet02.gryphon.com
"My opinions are that of my corporation!"