From owner-freebsd-hackers Thu Dec 21 01:04:27 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA22903 for hackers-outgoing; Thu, 21 Dec 1995 01:04:27 -0800 (PST) Received: from rah.star-gate.com (rah.star-gate.com [204.188.121.18]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA22897 for ; Thu, 21 Dec 1995 01:04:22 -0800 (PST) Received: from localhost.v-site.net (localhost.v-site.net [127.0.0.1]) by rah.star-gate.com (8.6.12/8.6.12) with SMTP id BAA00399 for ; Thu, 21 Dec 1995 01:04:17 -0800 Message-Id: <199512210904.BAA00399@rah.star-gate.com> X-Authentication-Warning: rah.star-gate.com: Host localhost.v-site.net didn't use HELO protocol X-Mailer: exmh version 1.6.2 7/18/95 To: hackers@FreeBSD.ORG Subject: pnp isolation program? Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 21 Dec 1995 01:04:16 -0800 From: "Amancio Hasty Jr." Sender: owner-hackers@FreeBSD.ORG Precedence: bulk Say can anyone tell me what am I doing wrong with this program? I can't get the serial ID of my PnP card. This is code is also part of a device driver.... Tnks, Amancio ----------- #include #include #include /* pnp isolation program */ /* send ID sequence */ static int send_ID_sequence(port) int port; { int cx; unsigned char al; for (al = 0x6a, cx = 0; cx < 32; cx++) { usleep(20); outb(port, al); al = (al >> 1 | ((al >> 1 ) ^ al & 1) << 7); } return (1); } static int get_ID_sequence(port) unsigned int port; { int cx; unsigned char al,al1; for (cx=0; cx < 72; cx++) { usleep(25000); al = inb(port); al1 = inb(port); printf("%x \n", al); } } main() { unsigned int id_port = 0x279; unsigned int id_write_port = 0xa79; open("/dev/io", O_RDWR, 0); usleep(20); send_ID_sequence(id_port); usleep(200); outb(id_port, 0x0); /* set pnp's read_port to 0x203 */ outb(id_port, 0x80); outb(id_port, 0x1); /* go get ID */ get_ID_sequence(0x203); }