Sun Microsystems manual Input and Output, Elements of S16A Applications

Page 10

Input and Output

S16A User’s Guide

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 -ls16aoption 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) ;

6

EDT, Inc. October, 1996

Image 10
Contents S16A EDT, Inc. October Contents Tables Overview Installing the Software InstallationInstalling the Hardware Using SunOS VersionS16A User’s Guide Installation Using System V Release 4 Solaris 2.4 or Later Building the Sample ProgramsIncluded Files ReadmeInput and Output Elements of S16A ApplicationsRoutine Description DMA Library RoutinesGeneral DMA Library Routines Syntax S16abufferaddressesS16A-specific Library Routines ArgumentsS16acancelcurrent S16acancelS16achecknextbuffer S16aclose S16aconfigureringbuffers ArgumentsS16adone S16agetdaccontrolregS16agetdiodatareg S16agetdiodirectionregS16agetoutputbits S16aopenS16aread S16aserialreadS16aserialstr S16aserialwriteS16asetdefaults S16asetdaccontrolregS16asetdiodatareg S16asetdiodirectionregS16asetoutputbits S16astartbuffersS16astopbuffers S16awaitforbufferS16awaitfornextbuffer S16awriteFoiparityerror Error ConditionsError Codes and Conditions Hardware Interface Electrical InterfaceSignal S16A I/O Description Interface SignalsS16A Interface Signals Pin Signal Connector PinoutConnector Pinout Registers SBus Addresses S16A ROMCurrent DMA Address Registers DMA RegistersNext DMA Address Registers Current Count Registers Control and Next Count RegistersDIO Direction Register Direct I/O RegistersDAC Output Control Register DIO Data RegisterName Description Analog Input Module Internal RegistersDAC Output Control Register Analog Input Module Internal RegistersInput Configuration Registers Input Clock Prescale RegistersTrim Register Use Trim RegistersInput Gain High Byte Values Trim Registers Trim Output Offset RegistersAnalog Input Module Control Protocol Temperature RegisterAnalog Input Module Uart Registers Trim Input Gain RegistersWrite to a Clock Prescale Register Write to an Input Configuration RegisterRead from an Input Configuration Register Read from a Clock Prescale RegisterUart Command/Status Register Uart Command/Status RegisterRead the Temperature Register Write to a Trim RegisterXilinx Programming Registers Uart Data RegisterSpecifications References Contacting EDT Index 15-16Configuration ROM