Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2001 11:55:44 -0600
From:      Lucas Bergman <lucas@slb.to>
To:        Greg Hormann <ghormann@ns.kconline.com>
Cc:        questions@freebsd.org
Subject:   Re: Direct Access to Parallel Port
Message-ID:  <20010223115544.B28130@billygoat.slb.to>
In-Reply-To: <Pine.BSF.4.05.10102222016410.18380-100000@hormann.tzo.cc>; from ghormann@ns.kconline.com on Thu, Feb 22, 2001 at 08:26:33PM -0500
References:  <Pine.BSF.4.05.10102222016410.18380-100000@hormann.tzo.cc>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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




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