This is a driver for Advantech's laboratory card . The file labcard.c has to be included in the linux/drivers/char and the file labcard.h in linux/include/linux. You have to edit Makefile in character device driver directory and add to OBJS variable labcard.o and to SRCS labcard.c. Than you should just follow Linux Installation and Getting Started Guide, section Upgrading the kernel. Then you have to run the inst_dev shell script as the root. It will install all devices in the /dev directory as lc?. The driver is built for character device. Therefore these function for device driver are available: ioctl, open, close, write, read. The ioctl can set the base address for the laboratory card (LC_ADDRESS). The base address is now set for the default base address, i.e. 0x220 (to change this write for example ioctl(fd, LC_ADDRESS, 0x210); - other possibilities are: 0x220, 0x230, 0x300, 0x3f0). In addition, the gain of the laboratory card can be set by ioctl and flag LC_GAIN (for example ioctl(fd,LC_GAIN,0);). Options for gain as well as base address follow possibilities of the PCL812PG Advantech's laboratory card. The functions open, close, read, write are similar as for other character devices. The open function can be called for example fd = open("/dev/lc0", O_RDONLY); this way. If the device is opened, it is not possible for another process to open the device. The read function asks for the data and waits until the conversion is done. Then it returns the result in the buffer. For example, a=read(fd,c,2); returns 2 bytes in c buffer. The write function writes two bytes in the following form: a = write(fd,i,2); where i is a buffer with data. The close function: close(fd); In the directory examples are test programs for reading, writing and changing card gain. See there for detailed examples. The device driver has major number 19. It can be changed, if it is already in use. Devices in the dev.tgz (for /dev directory) are for major 19. If the major number is changed it must be changed for /dev/lc[0-17] as well (see mknod). The driver has 18 minors. The minors 0 - 15 are O_RDONLY (/dev/lc[0-15], A/D channels). The minors 16 - 17 are O_WRONLY (/dev/lc[16-17], D/A channels). Further development is possible. In the directory examples are examples of the driver usage. Any comment, questions and recommendation send to: koren@vm.stuba.sk Richard Gosiorovsky gosiorov@vm.stuba.sk Tomas Hruz hruz@vm.stuba.sk http://dec50.vm.stuba.sk/~hruz Ludovit Koren koren@vm.stuba.sk