Sun Microsystems S16A User Manual

S16A
SBus 16-bit Dual Analog Interface
for the Sun SPARCstation
USER’S GUIDE
008-00630-01
ETD
The information in this document is subject to change without notice and does not represent a commitment on the part of Engineering Design Team, Inc. The software described in this document is furnished under a license agreement or nondisclosure agreement. The software may be used or copied only in accordance with the terms of the agreement.
No part of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, without the express written agreement of Engineering Design Team, Inc.
Copyright Engineering Design Team, Inc. 1992–1997. All rights reserved.
Refer questions or problems with this manual or the hardware or software described herein to: Engineering Design Team, Inc.
1100 NW Compton Drive, Suite 306 Beaverton, Oregon 97006
Phone: (503) 690-1234 Fax: (503) 690-1243 E-mail: info@edt.com Web: www.edt.com
Sun, SunOS, SBus, SPARC, and SPARCstation are trademarks of Sun Microsystems, Incorporated.
UNIX and OPEN LOOK are registered trademarks of UNIX System Laboratories, Inc.
X Window System is a product of the Massachusetts Institute of Technology.
EDT and Engineering Design Team are trademarks of Engineering Design Team, Inc.
ii
EDT, Inc. October, 1996
Contents
Overview.......................................................................................................................................................................1
Installation.....................................................................................................................................................................2
Installing the Hardware.....................................................................................................................................2
Installing the Software.......................................................................................................................................2
Using SunOS Version 4.1.........................................................................................................................2
Using System V Release 4 (Solaris 2.4 or Later) ...................................................................................4
Building the Sample Programs ...............................................................................................................4
Included Files......................................................................................................................................................5
Input and Output.........................................................................................................................................................6
Elements of S16A Applications ........................................................................................................................6
DMA Library Routines ......................................................................................................................................7
Error Conditions...............................................................................................................................................22
Hardware Interface....................................................................................................................................................23
Electrical Interface ............................................................................................................................................23
Interface Signals................................................................................................................................................24
Connector Pinout..............................................................................................................................................25
Registers.......................................................................................................................................................................26
SBus Addresses.................................................................................................................................................27
DMA Registers..................................................................................................................................................28
Current DMA Address Registers .........................................................................................................28
Next DMA Address Registers...............................................................................................................28
Current Count Registers ........................................................................................................................29
Control and Next Count Registers .......................................................................................................29
Direct I/O Registers.........................................................................................................................................30
DIO Direction Register...........................................................................................................................30
DIO Data Register...................................................................................................................................30
DAC Output Control Register........................................................................................................................30
Analog Input Module Internal Registers ......................................................................................................31
Input Clock Prescale Registers..............................................................................................................32
Input Configuration Registers ..............................................................................................................32
Trim Registers..........................................................................................................................................33
Temperature Register.............................................................................................................................34
Analog Input Module UART Registers.........................................................................................................34
Analog Input Module Control Protocol ..............................................................................................34
UART Command/Status Register........................................................................................................36
UART Data Register ...............................................................................................................................37
Xilinx Programming Registers........................................................................................................................37
Specifications ..............................................................................................................................................................38
References....................................................................................................................................................................39
Contacting EDT ..........................................................................................................................................................40
Index.............................................................................................................................................................................41
EDT, Inc. October, 1996 iii
Tables
General DMA Library Routines .....................................................................................................................................7
S16A-specific Library Routines......................................................................................................................................8
Error Codes and Conditions..........................................................................................................................................22
S16A Interface Signals..................................................................................................................................................24
Connector Pinout...........................................................................................................................................................25
DMA Channel Assignments .........................................................................................................................................28
Current DMA Address Registers..................................................................................................................................28
Next DMA Address Registers.......................................................................................................................................29
Current Count Registers................................................................................................................................................29
Control and Next Count Registers ................................................................................................................................29
DAC Output Control Register.......................................................................................................................................31
Analog Input Module Internal Registers.......................................................................................................................31
Input Selection (Low Byte) Values...............................................................................................................................32
Input Gain (High Byte) Values.....................................................................................................................................33
Trim Registers...............................................................................................................................................................33
UART Command/Status Register.................................................................................................................................36
iv EDT, Inc. October, 1996
S16A User’s Guide Overview
Overview
The S16A SBus 16-bit Dual Analog Interface is a single-slot board for SBus-based computer systems. The S16A has two analog I/O channels, each incorporating one 16-bit Analog-to-Digital (ADC) converter and one 20-bit Digital-to-Analog (DAC) converter. The S16A is designed for continuous input and output on both channels simultaneously and is typically used for scientific and medical research and development.
The S16A employs two Burr-Brown® PCM1702 analog output DACs running at a sample rate of 705.6KHz, which is 16 times the standard audio frequency of 44.1 KHz.
The two S16A analog input ADCs are National Semiconductor® ADC16071s, running with a base sampling rate of 192KHz. The S16A provides a clock prescale register to divide this frequency down for lower rates.
The S16A uses the SBus DMA interface and can transmit or receive any amount of data to and from host memory continuously on both channels at once.
Each I/O channel’s input ADC can monitor a differential signal, either of the two differential inputs as a single-ended signal, either of two I/O channels’ DAC outputs, or a reference ground. The ability to monitor the outputs directly or ground allows the S16A to be tested and adjusted using these internal loop-backs.
A portion of the functionality of the S16A is contained in a sub-assembly, the Analog Input Module. This module is controlled and configured using a byte-sequence protocol, as described in the section Analog Input Module Control Protocol beginning on page 34.
The S16A boards fully support the requirements of the SunOS operating system. Example programs are included. Each of the two I/O channels appears as two subdevices to the SunOS operating system, one for input and one for output, for a total of four subdevices.
This document explains how to install the S16A interface and driver and how to write applications for it. It is divided into the following sections:
Installation describes how to install the board and its related software. Input and Output describes the programming interface library. Hardware Interface Protocol provides a connector pin-out diagram and describes the S16A signals
and timing.
Registers describes the hardware registers. Specifications lists the product specifications. References lists other documentation resources that may be helpful. Contacting EDT describes how to contact EDT, and how to access EDT resources on the
Internet.
EDT, Inc. October, 1996 1
Installation S16A User’s Guide
Installation
Installing the S16A SBus 16-bit Dual Analog Interface is a two-step process. First you must physically install the board inside the host computer. Then you must install the software driver so that applications can access the S16A. Hardware installation is described in the following section. Software installation is described in the section after.
Installing the Hardware
The S16A board is a single-slot SBus board. To install it, refer to your SBus host computer documentation for complete information on installing an SBus board. For example, many Sun systems contain this information in a manual entitled SPARCstation Installation Guide.
Use the following procedure to install the SBus 16-bit Dual Analog Interface:
CAUTION
Both the S16A and your SBus host computer contain static-sensitive components. Install the S16A at a static-free work area. If a static-free work area is not available, take the following precautions to reduce the risk of component damage:
1. Remove from the immediate area all materials that can generate or hold a static charge.
2. Discharge yourself by touching both hands to a metal portion of the host computer’s chassis before you open the host computer or open the S16A static-shielded bag.
1. Unpack the SBus 16-bit Dual Analog Interface from the shipping packaging. Do not remove the S16A from the static shielding bag until you remove all other packaging materials from the area and establish a static-free work area.
2. Install the S16A in the SBus host, following the directions provided with the SBus host. The S16A can be installed in any DMA slot.
To remove the SBus 16-bit Dual Analog Interface, reverse the installation procedure. The SBus 16-bit Dual Analog Interface connects to your device with a cable. This cable is typically device-
specific.
Installing the Software
The S16A can run on a Sun workstation using either SunOS Version 4.1.3 or later or Solaris 2.4 or later (System V Release 4, or SVR 4). The installation procedures differ. Both are given below.
Using SunOS Version 4.1
If you are using SunOS Version 4.1.3 or later, use the following procedure to install the S16A driver:
1. Become root or superuser.
2. Create a directory in which you wish to install the S16A driver. EDT suggests /var/EDTs16a.
3. Change to the directory in which you wish to install the S16A driver.
2 EDT, Inc. October, 1996
S16A User’s Guide Installation
4. Place the diskette that came with the S16A into the diskette drive.
5. The S16A driver and related files are included on a diskette in tar format. To copy them to your hard disk, enter:
tar xvf /dev/rfd0
6. Thetar program extracts a number of files. (The list of files distributed is provided in the section entitled Included Files.) The S16A diskette contains versions of the S16A driver for a variety of Sun platforms and versions of the Sun operating system. The installation program installs the correct driver based on the host platform and operating system version.
7. To install the driver, enter:
make install
The makefile provided installs and loads the S16A driver.
8. During the installation, the following question appears on the display:
Automatically load the S16A driver during each reboot? [y|n] (y):
Entering y (or simply typing <Return>) causes the S16A driver to be loaded whenever you reboot your host computer. If you respond with n, you must manually reload the driver after rebooting. To do so, enter:
make load
9. During the installation, the following question appears on the display:
How many S16A devices do you want? (1):
You can install as many S16A boards in your system as you have DMA SBus slots available. Enter the number corresponding to the number of S16A boards you have installed in your system. If you simply type <Return>, one S16A device entry is installed. Note that each S16A board is appears to SunOS as one main device and four unidirectional subdevices, one input and one output each for both of the analog I/O channels.
NOTE: If you anticipate installing more than one S16A board into your system, install
as many S16A device entries as you will ultimately require. The extra device entries will do no harm and will be there when you need them, saving you a step.
10. If the S16A has not been installed inside the host computer, or has been installed incorrectly, the follow­ing message appears on the display:
Can’t load this module
If you see this message, go back to the section entitled Installing the Hardware and reinstall the board. If troubles persist, contact EDT for further assistance.
To unload the S16A driver:
1. Change to the directory in which you placed the S16A files, if you are not already there.
2. Become root or superuser.
EDT, Inc. October, 1996 3
Installation S16A User’s Guide
3. Enter:
make unload
Using System V Release 4 (Solaris 2.4 or Later)
If you are using Sun System V Release 4 (Solaris 2.4 or later), use the following procedure to install the S16A driver:
1. Become root or superuser.
2. Place the diskette that came with the S16A into the diskette drive.
3. Enter:
volcheck pkgadd -d /floppy/floppy0 EDTs16a
The pkgadd program asks several confirmation questions, which you can answer with a y for affirmative. Refer to your Solaris system administration documentation for further information on the pkgadd command.
To remove the S16A driver:
1. Become root or superuser.
2. Enter:
pkgrm EDTs16a
For further details, consult your Solaris 2.0 documentation, or call Engineering Design Team, Inc.
Building the Sample Programs
To build any of the example programs, enter the command:
make
file
where file is the name of the example program you wish to install, without the .c suffix. To build and install all the example programs, simply enter the command:
make
All example programs display a message that explains their usage when you invoke them with the -h switch.
4 EDT, Inc. October, 1996
S16A User’s Guide Installation
Included Files
The S16A driver release diskette contains the following files (see the readme file for a complete, up-to-date listing):
s16a.o.sun4c The executable S16A driver for SunOS 4.1.3 on a Sun 4C architecture such as a
SPARCStation 1, 1+, 2, or IPC.
s16a.o.sun4m The executable S16A driver for SunOS 4.1.3 on a Sun 4M architecture such as a
SPARCStation 5, 10, 20, LX, Classic, or an Ultra 1 or 2.
s16a The executable S16A driver for Solaris Version 2.4 or later. s16aload.c Initializes the S16A Xilinx hardware at boot time. s16a.rbt Xilinx data file. drv_ioctl.h Common driver architecture ioctl definitions. s16a_reg.h Hardware definitions for the drivers. libs16a.h Library definitions for applications using the libs16a.a library. libs16a.c Source code for the libs16a.a library. s16a.h The S16A driver header file, defining ioctls and registers. s16a.INSTALL The installation script used by the S16A makefile. makefile The makefile for installing, loading, and unloading the S16A driver, and making
example programs. Used with the SunOS make command to automatically install the driver or compile the example programs.
README An ASCII file containing last-minute information about the S16A software. setdebug.c This file sets the internal driver debug levels for the S16A. Call EDT for details. calfiles/* Calibration files whose names match the serial numbers of shipped units.
EDT, Inc. October, 1996 5
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() andwrite() 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) ;
6 EDT, Inc. October, 1996
S16A User’s Guide Input and Output
7. The -ls16a option to the compiler, to link the library file libs16a.a with your program
See the makefile and example programs provided for examples of compiling code using the library routines.
DMA Library Routines
The DMA library provides a set of consistent routines across many of the EDT products, with simple yet powerful ring-buffered DMA capabilities. Table 1, DMA Library Routines lists the general DMA library routines. In addition, if driver-specific library routines exist, they can be found in a table thereafter.
The sections that follow describe the DMA library routines in alphabetical order.
Routine Description
s16a_open Opens the S16A for application access. s16a_close Terminates access to the S16A and releases resources. s16a_read Single, application-level buffer read from the S16A. s16a_write Single, application-level buffer write to the S16A. s16a_set_defaults Restores the driver and hardware to factory-specified default state. s16a_configure_ring_buffers Configures the ring buffers. s16a_buffer_addresses Returns addresses of ring buffers. s16a_wait_for_buffer Blocks until specified buffers have completed. s16a_wait_for_next_buffer Blocks until the next buffer completes. s16a_check_next_buffer Checks whether next buffer is complete. s16a_start_buffers Begins transfer from or to specified number of buffers. s16a_cancel Shuts down the device as soon as possible, optionally resets it. s16a_cancel_current Cancels the current DMA, moves pointers to the next. s16a_stop_buffers Stops the interface after all buffers have completed. s16a_done_count Return absolute (cumulative) number of completed buffers. foi_parity_error Checks for parity error since last call.
Table 1. General DMA Library Routines
EDT, Inc. October, 1996 7
Input and Output S16A User’s Guide
The following driver-specific routines are also available:
Routine Description
s16a_get_dac_control_reg Get the current state of the output DAC control register. s16a_get_dio_data_reg Get the current state of the DIO Data register. s16a_get_dio_direction_reg Get the current state of the DIO Direction register. s16a_get_output_bits Get the output resolution of the S16A. s16a_serial_read Read a response string from the Analog Input module. s16a_serial_str Send a command string to the Analog Input module and return the
response only if it differs from the string sent. s16a_serial_write Send a command string to the Analog Input module. s16a_set_dac_control_reg Write a value to the output DAC Control register. s16a_set_dio_data_reg Write a value to the DIO Data register. s16a_set_dio_direction_reg Write a value to the DIO Direction register. s16a_set_output_bits Set the output resolution of the S16A.
Table 2. S16A-specific Library Routines
s16a_buffer_addresses
Description
Returns an array containing the addresses of the buffers.
Syntax
void **s16a_buffers(S16aDev *s16a_p);
Arguments
s16a_p S16A device handle returned from s16a_open.
Return
Address of an array of pointers to the ring buffers allocated by the driver or the library. The array of buffer pointers is allocated by the library. Null on error.
8 EDT, Inc. October, 1996
S16A User’s Guide Input and Output
s16a_cancel
Description
Stops any transfers currently in progress, resets the ring buffer pointers to restart on the current buffer.
Syntax
int s16a_cancel(S16aDev *s16a_p);
Arguments
s16a_p S16A device handle returned from s16a_open.
Return
0 on success, –1 on failure. Sets errno on failure.
s16a_cancel_current
Description
Stops the current transfers, resets the ring buffer pointers to the next buffer.
Syntax
int s16a_cancel(S16aDev *s16a_p);
Arguments
s16a_p S16A device handle returned from s16a_open.
Return
0 on success, –1 on failure. Sets errno on failure.
s16a_check_next_buffer
Description
Checks whether the next buffer is complete.
Syntax
int s16a_check_next_buffer(S16aDev *s16a_p);
Arguments
s16a_p S16A device handle returned from s16a_open.
Return
0 on success, –1 on failure. Sets errno on failure.
EDT, Inc. October, 1996 9
Input and Output S16A User’s Guide
s16a_close
Description
Closes the device associated with the device handle and frees the handle.
Syntax
int s16a_close(S16aDev *s16a_p);
Arguments
s16a_p S16A device handle returned from s16a_open.
Return
0 on success, –1 on failure. Sets errno on failure.
10 EDT, Inc. October, 1996
Loading...
+ 32 hidden pages