Specifications
A-1
A
Appendix AExample PCI User-Level Device Driver
1
1
1
This appendix contains an example of a user-level device driver for a National Instruments
PCI DIO-96 card.
/*
* Copyright (C) 1999 Concurrent Computer Corporation
* All rights reserved
*
* PCIex.c
*
* Sample very simple user level driver for National Instruments
* PCI DIO-96 card.
*
* Turns a LED on and off at two second intervals for two minutes.
*
* The Anode of LED is connected to pin 47 and the Cathode is
* connected to 510 ohm resistor which is connected to pin 49,
* which is +5 volts.
*
* The default power on state for the parallel port will be tristate
* which result in a off LED state.
*
* The manual for this card is available at following Web site.
*
* http://www.natlinst.com/manuals/
*
* User must have super user privledges to run.
*
* To compile use the following string.
*
* cc -F -lud -o PCIex PCIex.c
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ipl.h>
#include <sys/ipc.h>
#include <sys/signal.h>
#include <sys/lock.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/ioacc.h>
#include <userdriv.h>
#include <sys/pci.h>