From owner-freebsd-questions Tue Aug 8 10:36:57 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id KAA06798 for questions-outgoing; Tue, 8 Aug 1995 10:36:57 -0700 Received: from kryten.atinc.com (kryten.Atinc.COM [198.138.38.7]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id KAA06792 for <questions@freebsd.org>; Tue, 8 Aug 1995 10:36:52 -0700 Received: (jmb@localhost) by kryten.atinc.com (8.6.9/8.3) id NAA16821; Tue, 8 Aug 1995 13:29:16 -0400 Date: Tue, 8 Aug 1995 13:29:15 -0400 (EDT) From: "Jonathan M. Bresler" <jmb@kryten.Atinc.COM> Subject: Re: Accessing i/o map space with freebsd 2.1.0 To: Robin Hunt <ROBIN@ptnsct.nis.za> cc: questions@freebsd.org In-Reply-To: <950808145946.94e1@ptnsct.nis.za> Message-ID: <Pine.3.89.9508081334.C13865-0100000@kryten.atinc.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: questions-owner@freebsd.org Precedence: bulk On Tue, 8 Aug 1995, Robin Hunt wrote: > 1) Is it required that I write I driver no. > 2) If not, how can I use outb / inb without creating a bus error? open /dev/io. #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <machine/cpufunc.h> #include "if_smcreg.h" int main(int argc, char *argv[]) { if ( open("/dev/io", O_RDONLY, 0 ) != -1 ) { outw( 0x300 + BSR, BANK_2 ); outw( 0x300 + MMUCR, RESET_MMU); /* XXX need to delay here ? */ } else perror(""); return -1; } bizarre how O_RDONLY lets you write as well ;0 Jonathan M. Bresler jmb@kryten.atinc.com | Analysis & Technology, Inc. FreeBSD Postmaster jmb@FreeBSD.Org | 2341 Jeff Davis Hwy play go. | Arlington, VA 22202 ride bike. hack FreeBSD.--ah the good life | 703-418-2800 x346