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