/* * outb.c --- User mode program to write a byte to an I/O port. * * * 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 main( int argc, char *argv[] ) { int fd, status; __u16 address; __u8 value; char usage[] = "Usage: outb address value\n"; if ( argc == 3 ) { address = strtoul( argv[1], NULL, 0 ); value = strtoul( argv[2], NULL, 0 ); } else { fputs( usage, stderr ); exit(1); } fd = open( PORTIO_DEVICE, O_WRONLY ); if ( fd == (-1) ) { perror( "outb: open failed" ); exit(1); } status = portio_outb( fd, value, address ); if ( status == (-1) ) { perror( "outb: portio_outb failed" ); exit(1); } exit(0); }