Date: Thu, 15 Mar 2001 11:10:17 +1100 From: das@mbox.com.au To: freebsd-hardware@FreeBSD.ORG Cc: hackers@FreeBSD.ORG Subject: Parallel Programing in FreeBSD Message-ID: <3eb86b3f2779.3f27793eb86b@mbox.com.au>
next in thread | raw e-mail | index | archive | help
Hi, i'm trying to do some programming on freebsd and i can't find 'asm/io.h'. this must be for security reasons. so how do i talk to the parallel port? Thanks, Dave Seddon here's the really simple bit of code i'm trying to use: #include <stdio.h> #include <unistd.h> /* needed for ioperm() */ #include <asm/io.h> /* for outb() and inb() */ #define DATA 0x378 #define STATUS DATA+1 #define CONTROL DATA+2 int main(void) { int x = 0x32; int y = 0x08; if (ioperm(DATA,3,1)) { printf("Sorry, you were not able to gain access to the ports\n"); printf("You must be root to run this program\n"); exit(1); } outb(DATA, x); /* Sends 0011 0010 to the Data Port */ outb(CONTROL, y^0x0b); /* SELECT_IN = 1, INIT = 0, /AUTO_FEED = 0, /STROBE = 0 */ return (0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hardware" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3eb86b3f2779.3f27793eb86b>