Home | History | Annotate | Line # | Download | only in isa
elink.c revision 1.1
      1  1.1  mycroft #include <sys/types.h>
      2  1.1  mycroft #include <machine/pio.h>
      3  1.1  mycroft #include <i386/isa/elink.h>
      4  1.1  mycroft 
      5  1.1  mycroft /*
      6  1.1  mycroft  * This is the reset code for the dumb 3c50[79] cards which is required during
      7  1.1  mycroft  * probe.  The problem is that the two cards use the same reset to the ID_PORT
      8  1.1  mycroft  * and hence the two drivers will reset each others cards.  This is notably
      9  1.1  mycroft  * non-optimal.
     10  1.1  mycroft  */
     11  1.1  mycroft void
     12  1.1  mycroft elink_reset()
     13  1.1  mycroft {
     14  1.1  mycroft 	static int x = 0;
     15  1.1  mycroft 
     16  1.1  mycroft 	if (x == 0)
     17  1.1  mycroft 		outb(ELINK_ID_PORT, ELINK_RESET);
     18  1.1  mycroft 	x = 1;
     19  1.1  mycroft }
     20  1.1  mycroft 
     21  1.1  mycroft /*
     22  1.1  mycroft  * The `ID sequence' is really just snapshots of an 8-bit CRC register as 0
     23  1.1  mycroft  * bits are shifted in.  Different boards use different polynomials.
     24  1.1  mycroft  */
     25  1.1  mycroft void
     26  1.1  mycroft elink_idseq(p)
     27  1.1  mycroft 	register u_char p;
     28  1.1  mycroft {
     29  1.1  mycroft 	register int i;
     30  1.1  mycroft 	register u_char c;
     31  1.1  mycroft 
     32  1.1  mycroft 	c = 0xff;
     33  1.1  mycroft 	for (i = 255; i; i--) {
     34  1.1  mycroft 		outb(ELINK_ID_PORT, c);
     35  1.1  mycroft 		if (c & 0x80) {
     36  1.1  mycroft 			c <<= 1;
     37  1.1  mycroft 			c ^= p;
     38  1.1  mycroft 		} else
     39  1.1  mycroft 			c <<= 1;
     40  1.1  mycroft 	}
     41  1.1  mycroft }
     42