From owner-freebsd-questions Fri Feb 23 9:55:28 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dsl-64-193-218-89.telocity.com (dsl-64-193-218-89.telocity.com [64.193.218.89]) by hub.freebsd.org (Postfix) with SMTP id 7527C37B401 for ; Fri, 23 Feb 2001 09:55:25 -0800 (PST) (envelope-from lucas@slb.to) Received: (qmail 12460 invoked by uid 1000); 23 Feb 2001 17:55:45 -0000 Date: Fri, 23 Feb 2001 11:55:44 -0600 From: Lucas Bergman To: Greg Hormann Cc: questions@freebsd.org Subject: Re: Direct Access to Parallel Port Message-ID: <20010223115544.B28130@billygoat.slb.to> Reply-To: lucas@slb.to References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from ghormann@ns.kconline.com on Thu, Feb 22, 2001 at 08:26:33PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I need to control some solid state relays (SSRs) from my old P75. > In the past, I've used dos, Qbasic, and Parallel port to control up > to 8 SSRs. (Just by sending 0-255 to the correct I/O address, I can > turn on/off pins 2-9.) > > Anyway, I'd like to convert this DOS box over to FreeBSD so that I > can make changes remotely. How difficult would it be to send a byte > out to the I/O address of the parallel Port on a FreeBSD box? Not difficult, if you know C. The "official" (and more Unixly correct) way to do this is through the existing ppi interface; see ppi(4). Be warned, though, that ioctl()'s are slow. If this is a problem, you can always do stuff like void port_out_byte(unsigned port, unsigned char byte) { asm volatile("outb %0,%1" : : "a"(byte), "id"((unsigned short)(port))); } from a C program. Then `port_out_byte(0x378,0xa5)' would send the byte 0xa5 to port 0x378. > Secondly, Anybody ever worked on a driver for digital I/O boards? Maybe, but I definitely haven't. :) Lucas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message