Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Dec 1995 01:04:16 -0800
From:      "Amancio Hasty Jr." <hasty@rah.star-gate.com>
To:        hackers@FreeBSD.ORG
Subject:   pnp isolation program?
Message-ID:  <199512210904.BAA00399@rah.star-gate.com>

next in thread | raw e-mail | index | archive | help

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 <stdio.h>
#include <fcntl.h>
#include <machine/cpufunc.h>

/* 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);

} 






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