Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dma_alloc(K) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     DMA_ALLOC(K)              UNIX System V              DMA_ALLOC(K)



     Name
          dma_alloc - allocates a DMA channel

     Syntax
          #include "sys/dma.h"

          int
          dma_alloc(chan, mod)
          unsigned chan, mod;

     Description
          The dma_alloc routine allows dynamic allocation of a DMA
          channel.

     Parameters
          The chan argument specifies the channel to be allocated.
          Possible values are:

          8-Bit Channels:    DMA_CH0, DMA_CH1, DMA_CH2, DMA_CH3

          16-Bit Channels:   DMA_CH5, DMA_CH6, DMA_CH7

          Channel 4 is not available.  Other channels may be
          permanently allocated by system drivers.  Consult the
          /usr/adm/messages file for which channels are in use.  Use
          printcfg(K) in your driver initialization routine to display
          the DMA channel that you select.

          The mod argument can have one of two values:

               DMA_BLOCK      wait until the channel is available.  If
                              used, do not call from an interrupt
                              routine or an xxinit routine.

               DMA_NBLOCK     return immediately with a return status
                              of 0 (zero) if the channel was not free
                              at this time.

          If mod specifies blocking, the dma_alloc routine does not
          return until the requested channel is available.  It sleeps
          until the channel is released and always returns non-zero.
          If mod specifies non-blocking, the dma_alloc routine
          immediately returns non-zero if the channel is available,
          and zero if it is not.  The blocking option cannot be used
          at interrupt time, but the non-blocking option can be.

          Make certain that your DMA channel has been allocated before
          beginning your operations.

     Example
          An example of how to use this routine is:

          #include "sys/errno.h"
          #include "sys/dma.h"

                  extern struct dmareq dma_request;

                  /* Allocate channel 1.  If not */
                  /* currently available, wait.  */

                  if ( dma_alloc( DMA_CH1, DMA_BLOCK ) == 0 )
                  {
                          seterror( EIO );
                          return;
                  }

                  /* If channel is successfully allocated, */
                  /* then begin DMA streaming */

                  dma_start( &dma_request );

     See Also
          dma_param(K), dma_start(K), dma_relse(K), dma_enable(K),
          dma_resid(K), printcfg(K)

                                                      (printed 7/6/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026