Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2000 14:32:41 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Howard Blue <hblue@oaklandnet.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: C Programming using FreeBSD
Message-ID:  <20001107143241.A4569@dan.emsphone.com>
In-Reply-To: <3A085E29.4BA73D22@oaklandnet.com>; from "Howard Blue" on Tue Nov  7 11:55:22 GMT 2000
References:  <3A085E29.4BA73D22@oaklandnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Nov 07), Howard Blue said:
> How to use outb( ) and inb( ) with gcc and FreeBSD?
> 
> int main()
> {
> /* Getting accesss to io port. */
> if (ioperm(BASEPORT, 3, 1) {perror("ioperm"); exit(1);}
> 
> again:
>     outb(0, BASEPORT);
>     sleep(1);
>     outb(0xFF, BASEPORT);
>     sleep(1);
>     printf("Testing...\n");\
> goto again;
> }
> 
> What changes would be necessary for a simillar program to work with
> FreeBSD?

#include <machine/cpufunc.h>, call i386_set_ioperm() to enable access
to an i/o port, and swap the arguments to outb.

-- 
	Dan Nelson
	dnelson@emsphone.com


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?20001107143241.A4569>