Sun Microsystems S16A Laptop User Manual


 
Input and Output S16A User’s Guide
6 EDT, Inc. October, 1996
Input and Output
The driver can perform two kinds of DMA transfers: continuous and noncontinuous. For noncontinuous
transfers, the driver uses DMA system calls for read() and write(). Each read() and write() system call allocates
kernel resources, during which time DMA transfers are interrupted.
To perform continuous transfers, use the ring buffers. The ring buffers area set of buffers that applications
can access continuously, reading and writing as required. When the last buffer in the set has been accessed,
the application then cycles back to the first buffer. See s16a_configure_ring_buffers for a complete
description of the ring buffer parameters that you can configure.
Elements of S16A Applications
S16A applications for performing noncontinuous transfers typically include the following elements:
1. The preprocessor statement
#include "libs16a.h"
2. A call to s16a_open(), such as:
s16a_p = s16a_open(s16a_p) ;
3. A call to s16a_read() or s16a_write(), such as:
s16a_read(s16a_p, buf_ptr, 512) ;
or:
s16a_write(s16a_p, buf_ptr, 1024) ;
4. A call to s16a_close() to close the device before ending the program, such as:
s16a_close(s16a_p) ;
5. The -ls16a option to the compiler, to link the library file libs16a.a with your program
S16A applications for performing continuous transfers typically include the following elements:
1. The preprocessor statement
#include "s16a.h"
2. A call to s16a_open(), such as:
s16a_p = s16a_open(s16a_p) ;
3. A call to s16a_configure_ring_buffers() to set up the ring buffers as required, such as:
s16a_configure_ring_buffers(s16a_p, 1024, 4, NULL, EDT_READ) ;
4. A call to s16a_start_buffers() with an argument of 0 to initiate a continuous transfer, such as:
s16a_start_buffers(s16a_p, 0) ;
5. A call to s16a_wait_for_buffer() or s16a_wait_for_next_buffer() to , such as:
buf_ptr = s16a_wait_for_buffer(s16a_p, 4) ;
6. A call to s16a_close() to close the device before ending the program, as in:
s16a_close(s16a_p) ;