/* * libportio.c --- User mode library for Linux port I/O device driver. * * Author: William Lavender * *---------------------------------------------------------------------- * * Copyright 1999 Illinois Institute of Technology * * See the file "LICENSE" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ #include #include #include #include #include "portio.h" int portio_outb( int fd, __u8 value, __u16 address ) { portio_message temp; int status; temp.address = address; temp.arg.byte = value; status = ioctl( fd, PORTIO_OUTB_IOCTL, (void *) &temp ); return status; } int portio_outw( int fd, __u16 value, __u16 address ) { portio_message temp; int status; temp.address = address; temp.arg.word = value; status = ioctl( fd, PORTIO_OUTW_IOCTL, (void *) &temp ); return status; } int portio_inb( int fd, __u8 *value, __u16 address ) { portio_message temp; int status; if ( value == NULL ) return EINVAL; temp.address = address; status = ioctl( fd, PORTIO_INB_IOCTL, (void *) &temp ); if ( status == 0 ) { *value = temp.arg.byte; } return status; } int portio_inw( int fd, __u16 *value, __u16 address ) { portio_message temp; int status; if ( value == NULL ) return EINVAL; temp.address = address; status = ioctl( fd, PORTIO_INW_IOCTL, (void *) &temp ); if ( status == 0 ) { *value = temp.arg.word; } return status; } int portio_getmap( int fd, portio_permission_map *map ) { return ioctl( fd, PORTIO_GETMAP_IOCTL, (void *) map ); }