Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 1999 13:16:20 -0500
From:      Greg Lehey <grog@mojave.sitaranetworks.com>
To:        Cliff Addy <fbsdlist@federation.addy.com>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Programming question
Message-ID:  <19991118131620.50699@mojave.sitaranetworks.com>
In-Reply-To: <Pine.BSF.3.95q.991118115951.15379B-100000@federation.addy.com>; from Cliff Addy on Thu, Nov 18, 1999 at 12:03:20PM -0500
References:  <Pine.BSF.3.95q.991118115951.15379B-100000@federation.addy.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, 18 November 1999 at 12:03:20 -0500, Cliff Addy wrote:
> I'm looking at a watchdog card to integrate into our servers here.  To use
> it, according to the docs, we need to write a C program that will "read
> I/O register 180H."
>
> I'm a fairly experienced C programmer, but not sure how this would be
> accomplished in FreeBSD.  Any care to give me a code snippet that does
> this?

Well, to do it right, it's not a code snippet.  You need a driver:
userland shouldn't access I/O registers directly.  There are ways
around this restriction, but you shouldn't use them unless you have a
*very* good reason.

Having said that, the code itself is trivial:

#include <machine/cpufunc.h>

...

  value = inb (0x180);

This assumes that you're reading a byte; look at cpufunc.h for the
gory details.

Greg
--
When replying to this message, please copy the original recipients.
For more information, see http://www.lemis.com/questions.html
Finger grog@lemis.com for PGP public key
See complete headers for address and phone numbers


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?19991118131620.50699>