mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-25 03:54:17 +01:00
Add National Instruments "LabPC" driver
This commit is contained in:
parent
4843859879
commit
657e73c4f5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8114
54
etc/MAKEDEV
54
etc/MAKEDEV
@ -63,6 +63,11 @@
|
||||
#
|
||||
# Call units:
|
||||
#
|
||||
# SCSI devices (other than CD-ROM, tape and disk)
|
||||
# uk* "unknown" device (supports ioctl calls only)
|
||||
# worm* WORM driver
|
||||
# pt* Processor Type (HP scanner, as one example)
|
||||
#
|
||||
# Special purpose devices:
|
||||
# bpf* packet filter
|
||||
# speaker pc speaker
|
||||
@ -76,8 +81,9 @@
|
||||
# tun Tunneling IP device
|
||||
# spigot Video Spigot video aquisition card
|
||||
# isdn* ISDN devices
|
||||
# labpc* National Instrument's Lab-PC and LAB-PC+
|
||||
#
|
||||
# $Id: MAKEDEV,v 1.83 1995/04/23 12:02:21 ache Exp $
|
||||
# $Id: MAKEDEV,v 1.84 1995/04/26 08:07:30 bde Exp $
|
||||
#
|
||||
|
||||
PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
|
||||
@ -858,6 +864,52 @@ isdn*)
|
||||
esac
|
||||
;;
|
||||
|
||||
# dufault@hda.com: If I do much more work on other A-D boards
|
||||
# then eventually we'll have a "ad" and "dio" interface and some of these
|
||||
# "labpcaio" ones will be gone.
|
||||
# labpcaio: D-A and A-D.
|
||||
# labpcdio: Digital in and Digital out.
|
||||
#
|
||||
labpc*)
|
||||
umask 7
|
||||
case $i in
|
||||
labpcaio*)
|
||||
name=labpcaio
|
||||
unit=`expr $i : 'labpcaio\(.*\)'`
|
||||
all="0 1 2 3 4 5 6 7"
|
||||
offset=0
|
||||
;;
|
||||
labpcdio*)
|
||||
name=labpcdio
|
||||
unit=`expr $i : 'labpcdio\(.*\)'`
|
||||
all="0 1 2 3"
|
||||
offset=128
|
||||
;;
|
||||
*)
|
||||
echo "Don't understand that labpc name"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
if [ "X${unit}" = "X" ]; then
|
||||
unit=all
|
||||
fi
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7)
|
||||
mknod $name$unit c 66 `expr $offset + $unit `
|
||||
;;
|
||||
all)
|
||||
for i in $all
|
||||
do
|
||||
mknod $name$i c 66 `expr $offset + $i `
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "No such LabPC unit: $unit"
|
||||
;;
|
||||
esac
|
||||
umask 77
|
||||
;;
|
||||
|
||||
local)
|
||||
umask 0 # XXX should be elsewhere
|
||||
sh MAKEDEV.local
|
||||
|
@ -63,6 +63,11 @@
|
||||
#
|
||||
# Call units:
|
||||
#
|
||||
# SCSI devices (other than CD-ROM, tape and disk)
|
||||
# uk* "unknown" device (supports ioctl calls only)
|
||||
# worm* WORM driver
|
||||
# pt* Processor Type (HP scanner, as one example)
|
||||
#
|
||||
# Special purpose devices:
|
||||
# bpf* packet filter
|
||||
# speaker pc speaker
|
||||
@ -76,8 +81,9 @@
|
||||
# tun Tunneling IP device
|
||||
# spigot Video Spigot video aquisition card
|
||||
# isdn* ISDN devices
|
||||
# labpc* National Instrument's Lab-PC and LAB-PC+
|
||||
#
|
||||
# $Id: MAKEDEV,v 1.83 1995/04/23 12:02:21 ache Exp $
|
||||
# $Id: MAKEDEV,v 1.84 1995/04/26 08:07:30 bde Exp $
|
||||
#
|
||||
|
||||
PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
|
||||
@ -858,6 +864,52 @@ isdn*)
|
||||
esac
|
||||
;;
|
||||
|
||||
# dufault@hda.com: If I do much more work on other A-D boards
|
||||
# then eventually we'll have a "ad" and "dio" interface and some of these
|
||||
# "labpcaio" ones will be gone.
|
||||
# labpcaio: D-A and A-D.
|
||||
# labpcdio: Digital in and Digital out.
|
||||
#
|
||||
labpc*)
|
||||
umask 7
|
||||
case $i in
|
||||
labpcaio*)
|
||||
name=labpcaio
|
||||
unit=`expr $i : 'labpcaio\(.*\)'`
|
||||
all="0 1 2 3 4 5 6 7"
|
||||
offset=0
|
||||
;;
|
||||
labpcdio*)
|
||||
name=labpcdio
|
||||
unit=`expr $i : 'labpcdio\(.*\)'`
|
||||
all="0 1 2 3"
|
||||
offset=128
|
||||
;;
|
||||
*)
|
||||
echo "Don't understand that labpc name"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
if [ "X${unit}" = "X" ]; then
|
||||
unit=all
|
||||
fi
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7)
|
||||
mknod $name$unit c 66 `expr $offset + $unit `
|
||||
;;
|
||||
all)
|
||||
for i in $all
|
||||
do
|
||||
mknod $name$i c 66 `expr $offset + $i `
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "No such LabPC unit: $unit"
|
||||
;;
|
||||
esac
|
||||
umask 77
|
||||
;;
|
||||
|
||||
local)
|
||||
umask 0 # XXX should be elsewhere
|
||||
sh MAKEDEV.local
|
||||
|
151
share/man/man4/man4.i386/labpc.4
Normal file
151
share/man/man4/man4.i386/labpc.4
Normal file
@ -0,0 +1,151 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1995 HD Associates, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Christopher G. Demetriou.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software withough specific prior written permission
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.rm ES
|
||||
.rm EE
|
||||
.de ES
|
||||
.Pp
|
||||
.nf
|
||||
.in +0.5i
|
||||
..
|
||||
.de EE
|
||||
.in -0.5i
|
||||
.fi
|
||||
..
|
||||
.Dd April 26, 1995
|
||||
.Dt LABPC 4 i386
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm labpc
|
||||
.Nd
|
||||
National Instruments LABPC and LABPC+ driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device labpc0 at isa? port 260 tty irq 5 vector labpcintr
|
||||
.Sh DESCRIPTION
|
||||
This supports the National Instruments LABPC and LABPC+ \fILow-Cost
|
||||
Multifunction I/O Board\fP.
|
||||
.sp
|
||||
This board provides 8 12 bit A-D input channels, 2 12 bit D-A output
|
||||
channels, and 3 8 bit digital I/O ports. It also supports setting
|
||||
up the National Instruments SCXI bus off the digital I/O ports,
|
||||
although that software is currently present in an external program
|
||||
and not as part of the driver.
|
||||
.Pp
|
||||
The selection of the input or output device, mode, and channel is
|
||||
through the minor number:
|
||||
.ES
|
||||
The 8 bit minor number format is UUSIDCCC, with
|
||||
UU: Board unit.
|
||||
S: SCAN bit for scan enable.
|
||||
I: INTERVAL for interval support
|
||||
D: 1: Digital I/O, 0: Analog I/O
|
||||
CCC: The channel selector:
|
||||
ANALOG:
|
||||
input: channel must be 0 to 7 for AD0 ... AD7
|
||||
output: channel must be 0 to 2
|
||||
0: D-A 0
|
||||
1: D-A 1
|
||||
2: Alternate channel 0 then 1
|
||||
|
||||
DIGITAL:
|
||||
input: Channel must be 0 to 2.
|
||||
output: Channel must be 0 to 2.
|
||||
.EE
|
||||
.Pp
|
||||
The /dev/MAKEDEV script will make the basic analog and digital
|
||||
devices if you do "sh MAKEDEV labpcaio" and "sh MAKEDEV labpcdio",
|
||||
however, it won't make device entries for INTERVAL and SCAN devices.
|
||||
SCAN devices automatically scan over all channels from the channel
|
||||
number down to 0 (for example, a SCAN for /dev/ad7 will read channels
|
||||
AD7 ... AD0) while the INTERVAL device will wait for an external
|
||||
signal and then read all the channels from the selected channel
|
||||
number down to 0 as fast as it can. This is done by the hardware
|
||||
and not the driver (other than turning it on); See the \fILabPC+
|
||||
User's Manual\fP and the source code if this doesn't make sense to
|
||||
you.
|
||||
.Pp
|
||||
The driver supports several Analog I/O ioctl calls. These are defined
|
||||
in sys/aio.h and are intended to be compatable with other AIO board
|
||||
device drivers.
|
||||
.Pp
|
||||
AD_MICRO_PERIOD_SET takes a pointer to a long argument specifying
|
||||
the number of microseconds between samples.
|
||||
.Pp
|
||||
AD_MICRO_PERIOD_GET takes a pointer to a long argument and returns
|
||||
the current number of microseconds between samples.
|
||||
.Pp
|
||||
AD_NGAINS_GET takes a pointer to an integer and returns the number
|
||||
of different gain settings the board supports. This is 8 for the
|
||||
LabPC board.
|
||||
.Pp
|
||||
AD_NCHANS_GET takes a pointer to an integer and returns the number
|
||||
of channels the board supports. This is 8 for the LabPC board.
|
||||
.Pp
|
||||
AD_SUPPORTED_GAINS returns an array of NGAINS (the number obtained
|
||||
by AD_NGAINS_GET) doubles. These are the gains the board supports.
|
||||
.Pp
|
||||
AD_GAINS_SET takes an array of NCHANS (the number obtained by
|
||||
AD_NCHANS_GET) integers and sets the board gains. These are indices
|
||||
into the supported gain array, with one gain for each channel.
|
||||
.Pp
|
||||
AD_GAINS_GET takes an array of NCHANS (returned by AD_NCHANS_GET)
|
||||
integers and returns the cuurrent board gains.
|
||||
.Sh SEE ALSO
|
||||
.Xr aio 1
|
||||
.Sh BUGS
|
||||
In general, only those capabilities that I needed are present. In
|
||||
particular the following notable restrictions are present.
|
||||
.sp
|
||||
The analog input is only supported in a clocked conversion mode.
|
||||
.Pp
|
||||
You can only set the sample clock down to 15 Hz. Anything slower
|
||||
needs a modification to the driver to support TCINTEN in order to
|
||||
chain together the counters to get a lower clock rate.
|
||||
.Pp
|
||||
There is no support for clocked D-A output.
|
||||
.Pp
|
||||
The 8255 providing the digital I/O ports is supported only in mode
|
||||
0 (three 8 bit ports).
|
||||
.Pp
|
||||
There is support for the SCXI bus off the LABPC board. It is not
|
||||
in the driver but is a separate user process that accesses the
|
||||
digital I/O devices. Ask dufault@hda.com for it.
|
||||
.Pp
|
||||
MAKEDEV only makes the "basic" devices. You must make the INTERVAL
|
||||
or SCAN devices by hand.
|
||||
.Pp
|
||||
The INTERVAL device sets the clock rate as high as possible so that
|
||||
it samples all the channels as quickly as it can after the external
|
||||
signal. This is a silly restriction; it should simply use the
|
||||
clock setting.
|
||||
.Sh CAVEATS
|
||||
National Instrument's (like most other laboratory grade board
|
||||
vendors) definition of Low-Cost differs dramatically from many on
|
||||
the net.
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.174 1995/04/24 05:33:59 phk Exp $
|
||||
# $Id: LINT,v 1.175 1995/04/25 03:44:04 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -638,6 +638,8 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# gp: National Instruments AT-GPIB and AT-GPIB/TNT board
|
||||
# gsc: Genius GS-4500 hand scanner.
|
||||
# joy: joystick
|
||||
# labpc: National Instrument's Lab-PC and Lab-PC+
|
||||
|
||||
#
|
||||
# Notes on the spigot:
|
||||
# The video spigot is at 0xad6. This port address can not be changed.
|
||||
@ -659,6 +661,7 @@ device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port "IO_GAME"
|
||||
device cy0 at isa? tty irq 10 iomem 0xd4000 vector cyintr
|
||||
device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr
|
||||
|
||||
#
|
||||
# PCI devices:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.96 1995/04/23 09:12:00 julian Exp $
|
||||
# $Id: files.i386,v 1.97 1995/04/23 18:30:27 wollman Exp $
|
||||
#
|
||||
aic7xxx_asm optional ahc device-driver \
|
||||
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
|
||||
@ -89,6 +89,7 @@ i386/isa/if_zp.c optional zp device-driver
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
i386/isa/lpt.c optional lpt device-driver
|
||||
i386/isa/labpc.c optional labpc device-driver
|
||||
i386/isa/mcd.c optional mcd device-driver
|
||||
i386/isa/mse.c optional mse device-driver
|
||||
i386/isa/ncr5380.c optional nca device-driver
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.174 1995/04/24 05:33:59 phk Exp $
|
||||
# $Id: LINT,v 1.175 1995/04/25 03:44:04 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -638,6 +638,8 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# gp: National Instruments AT-GPIB and AT-GPIB/TNT board
|
||||
# gsc: Genius GS-4500 hand scanner.
|
||||
# joy: joystick
|
||||
# labpc: National Instrument's Lab-PC and Lab-PC+
|
||||
|
||||
#
|
||||
# Notes on the spigot:
|
||||
# The video spigot is at 0xad6. This port address can not be changed.
|
||||
@ -659,6 +661,7 @@ device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port "IO_GAME"
|
||||
device cy0 at isa? tty irq 10 iomem 0xd4000 vector cyintr
|
||||
device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr
|
||||
|
||||
#
|
||||
# PCI devices:
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.174 1995/04/24 05:33:59 phk Exp $
|
||||
# $Id: LINT,v 1.175 1995/04/25 03:44:04 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -638,6 +638,8 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# gp: National Instruments AT-GPIB and AT-GPIB/TNT board
|
||||
# gsc: Genius GS-4500 hand scanner.
|
||||
# joy: joystick
|
||||
# labpc: National Instrument's Lab-PC and Lab-PC+
|
||||
|
||||
#
|
||||
# Notes on the spigot:
|
||||
# The video spigot is at 0xad6. This port address can not be changed.
|
||||
@ -659,6 +661,7 @@ device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port "IO_GAME"
|
||||
device cy0 at isa? tty irq 10 iomem 0xd4000 vector cyintr
|
||||
device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr
|
||||
|
||||
#
|
||||
# PCI devices:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.96 1995/04/23 09:12:00 julian Exp $
|
||||
# $Id: files.i386,v 1.97 1995/04/23 18:30:27 wollman Exp $
|
||||
#
|
||||
aic7xxx_asm optional ahc device-driver \
|
||||
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
|
||||
@ -89,6 +89,7 @@ i386/isa/if_zp.c optional zp device-driver
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
i386/isa/lpt.c optional lpt device-driver
|
||||
i386/isa/labpc.c optional labpc device-driver
|
||||
i386/isa/mcd.c optional mcd device-driver
|
||||
i386/isa/mse.c optional mse device-driver
|
||||
i386/isa/ncr5380.c optional nca device-driver
|
||||
|
@ -42,7 +42,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
|
||||
* $Id: conf.c,v 1.82 1995/04/10 20:40:11 wollman Exp $
|
||||
* $Id: conf.c,v 1.83 1995/04/14 15:13:26 dufault Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1003,6 +1003,19 @@ d_ttycv_t rcdevtotty;
|
||||
#define rcdevtotty nxdevtotty
|
||||
#endif
|
||||
|
||||
#include "labpc.h"
|
||||
#if NLABPC > 0
|
||||
d_open_t labpcopen;
|
||||
d_close_t labpcclose;
|
||||
d_strategy_t labpcstrategy;
|
||||
d_ioctl_t labpcioctl;
|
||||
#else
|
||||
#define labpcopen nxopen
|
||||
#define labpcclose nxclose
|
||||
#define labpcstrategy nxstrategy
|
||||
#define labpcioctl nxioctl
|
||||
#endif
|
||||
|
||||
/* open, close, read, write, ioctl, stop, reset, ttys, select, mmap, strat */
|
||||
struct cdevsw cdevsw[] =
|
||||
{
|
||||
@ -1214,6 +1227,9 @@ struct cdevsw cdevsw[] =
|
||||
{ sctargopen, sctargclose, rawread, rawwrite, /*65*/
|
||||
sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */
|
||||
seltrue, nommap, sctargstrategy },
|
||||
{ labpcopen, labpcclose, rawread, rawwrite, /*66*/
|
||||
labpcioctl, nostop, nullreset, nodevtotty,/* labpc */
|
||||
seltrue, nommap, labpcstrategy },
|
||||
};
|
||||
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
|
||||
|
||||
|
1051
sys/i386/isa/labpc.c
Normal file
1051
sys/i386/isa/labpc.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user