Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jun 2000 09:57:07 +0100 (BST)
From:      Mac <mac@ngo.org.uk>
To:        ben@scientia.demon.co.uk (Ben Smithurst)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Writing a value to an IO (mem mapped) port
Message-ID:  <200006010857.JAA20643@ngo.org.uk>
In-Reply-To: <20000531192931.Q99925@strontium.scientia.demon.co.uk> from Ben Smithurst at "May 31, 0 07:29:31 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Ben Smithurst Wrote
> Mac wrote:
> 
> > However under FreeBSD, although the function seems to exist to do this
> > in /usr/include/machine/cpufunc.h, I get Bus Errors every time I try.
> > 
> > fred.c looks like this:-
> > 
> > 	#include <sys/types.h>
> > 	#include <machine/cpufunc.h>
> > 
> > 	main()
> > 	{
> > 	 outb(0x181,0)
> > 	}
> > 
> > And compiles OKay.
> 
> "man i386_set_ioperm" might help you.  I'm guessing you'll want to call
> 
> i386_set_ioperm(0x181, 1, 1);
> 
> before the call to outb(), but as I've never used this function I can't
> be sure exactly.
> 

Right, next question.


I can't get i386_{set,get}_ioperm to work.  All attempts at calling these functions
result in a return value of -1 (errno=22 (EINVAL)).


Code I'm using looks like this:-

    #include <errno.h>
    #include <machine/sysarch.h>

    main()
    {
    unsigned int port;
    unsigned int *length;
    int *enable;
    
    int res;

    port = 0x180;

    res = i386_get_ioperm(port,length,enable);

    [then a whole string of printf statements]
    
    }

Any one know what I'm doing wrong?

                       Mac


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006010857.JAA20643>