From owner-freebsd-hardware Wed Apr 16 07:40:12 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id HAA00448 for hardware-outgoing; Wed, 16 Apr 1997 07:40:12 -0700 (PDT) Received: from bacall.lodgenet.com (bacall.lodgenet.com [205.138.147.242]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id HAA00434 for ; Wed, 16 Apr 1997 07:40:04 -0700 (PDT) Received: (from mail@localhost) by bacall.lodgenet.com (8.6.12/8.6.12) id JAA16010; Wed, 16 Apr 1997 09:39:05 -0500 Received: from garbo.lodgenet.com(204.124.123.250) by bacall via smap (V1.3) id sma016008; Wed Apr 16 09:39:02 1997 Received: from jake.lodgenet.com ([10.0.11.30]) by garbo.lodgenet.com (8.6.12/8.6.9) with ESMTP id JAA09290; Wed, 16 Apr 1997 09:38:47 -0500 Received: from jake.lodgenet.com (localhost [127.0.0.1]) by jake.lodgenet.com (8.8.5/8.6.12) with ESMTP id JAA00602; Wed, 16 Apr 1997 09:39:03 -0500 (CDT) Message-Id: <199704161439.JAA00602@jake.lodgenet.com> X-Mailer: exmh version 2.0gamma 1/27/96 To: Luiz de Barros cc: freebsd-hardware@FreeBSD.ORG Subject: Re: talk to I/O Devices. In-reply-to: Your message of "Wed, 16 Apr 1997 10:18:14 -0300." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 16 Apr 1997 09:39:03 -0500 From: "Eric L. Hernes" Sender: owner-hardware@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Luiz de Barros writes: >Dear FreeBSD Experts, > >I would like to know how i can talk to an input/output device attached to >some I/O ports in C. I want something equivalent to outportb and inportb >from DOS. The board we want to develop is a remote power controller to >reset our computers in case of a crash. The board will be controlled by >I/O ports. #include #include int main(int ac, char **av) { int fd; if((fd=open("/dev/io", O_RDWR))<0){ perror("/dev/io"); return 1; } outb(addr, val); inb(addr); outsw(addr, string); ... return 0; } should do it. > >Thanks in Advance, > >Luiz >Nlink ISP. > eric. -- erich@rrnet.com http://rrnet.com/~erich erich@freebsd.org http://www.freebsd.org/~erich erich@lodgenet.com