From owner-freebsd-questions@FreeBSD.ORG Wed Jun 11 15:45:47 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AFFE37B401 for ; Wed, 11 Jun 2003 15:45:47 -0700 (PDT) Received: from multiweb.ca (modemcable051.38-200-24.mtl.mc.videotron.ca [24.200.38.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA18D43F3F for ; Wed, 11 Jun 2003 15:45:45 -0700 (PDT) (envelope-from amyfoub@videotron.ca) Received: from guillaume.multiweb.ca (guillaume [192.168.1.10]) by multiweb.ca (8.12.9/8.12.6) with ESMTP id h5BMjfg3001683; Wed, 11 Jun 2003 18:45:42 -0400 (EDT) (envelope-from amyfoub@videotron.ca) From: Guillaume To: Bernard Dugas , freebsd-questions@freebsd.org Date: Wed, 11 Jun 2003 18:45:41 -0400 User-Agent: KMail/1.5 References: <20030609175804.043AA37B405@hub.freebsd.org> <3EE65F83.9A1890FA@is-production.com> In-Reply-To: <3EE65F83.9A1890FA@is-production.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200306111845.41486.amyfoub@videotron.ca> Subject: Re: how to talk to the serial and parallel ports through a C X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2003 22:45:47 -0000 On 10 June 2003 18:45, Bernard Dugas wrote: > Hi, > > I also did some programming on serial port to control pins with a c > program under linux, but I didn't found any simple way to port it > under freebsd. Any hint ? > > For instance, I need the equivalent of : > inb(adr) > outb(val,adr) > iopl(n) > ioperm(adr) > > from and in linux. Try that: =2D-------------------------------------- #include #include #include #include #include #define porta 0x378 #define portb 0x379 const char *filename; int main(void) { int fd, data; filename =3D "/dev/io"; fd =3D open(filename, O_RDWR); if (fd < 0) { printf("Erreur d'acc=E8s =E0 %s\n", filename); exit(1); } outb(porta, 0xFF); sleep(1); outb(porta, 0x00); sleep(1); data =3D (inb(portb)); printf("data =3D %x\n", data); close(fd); exit(0); } =2D-------------------------------------------- Works with FreeBSD 5.x, I don't know with 4.x Guillaume > > Best regard, > Bernard Dugas > > > ------------------------------ > > > > Message: 32 > > Date: Mon, 09 Jun 2003 09:44:28 -0700 > > From: Dan Malaby > > Subject: how to talk to the serial and parallel ports through a C > > program > > To: freebsd-questions@freebsd.org > > Message-ID: <5.1.0.14.2.20030609093752.00a69d20@pop3.peritek.com> > > Content-Type: text/plain; charset=3D"us-ascii"; format=3Dflowed > > > > I was wondering if there was a good place to go to get programing > > examples on how to > > talk to the serial and parallel ports. I have looked in the > > developers handbook but have not > > any luck finding what I want. > > > > Any pointers would be appreciated > > > > Thanks > > > > Daniel Malaby voice:(510) 531-6500 > > Peritek Corp. fax: (510) 530-8563 > > 5550 Redwood Road email: dan@peritek.com > > Oakland, CA 94619 > > > > ------------------------------