25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_mc146818.c,v 1.68 2005/02/07 05:51:54 debug Exp $ |
* $Id: dev_mc146818.c,v 1.69 2005/05/20 07:42:12 debug Exp $ |
29 |
* |
* |
30 |
* MC146818 real-time clock, used by many different machines types. |
* MC146818 real-time clock, used by many different machines types. |
31 |
* (DS1687 as used in some SGI machines is similar to MC146818.) |
* (DS1687 as used in some SGI machines is similar to MC146818.) |
587 |
d->access_style = access_style; |
d->access_style = access_style; |
588 |
d->addrdiv = addrdiv; |
d->addrdiv = addrdiv; |
589 |
|
|
590 |
|
/* Only SGIs and PCs use BCD format (?) */ |
591 |
|
d->use_bcd = 0; |
592 |
|
if (access_style == MC146818_SGI || access_style == MC146818_PC_CMOS) |
593 |
|
d->use_bcd = 1; |
594 |
|
|
595 |
|
if (access_style == MC146818_DEC) { |
596 |
/* Station Ethernet Address, on DECstation 3100: */ |
/* Station Ethernet Address, on DECstation 3100: */ |
597 |
for (i=0; i<6; i++) |
for (i=0; i<6; i++) |
598 |
ether_address[i] = 0x10 * (i+1); |
ether_address[i] = 0x10 * (i+1); |
599 |
|
|
600 |
d->reg[0x01] = ether_address[0]; |
d->reg[0x01] = ether_address[0]; |
601 |
d->reg[0x05] = ether_address[1]; |
d->reg[0x05] = ether_address[1]; |
602 |
d->reg[0x09] = ether_address[2]; |
d->reg[0x09] = ether_address[2]; |
603 |
d->reg[0x0d] = ether_address[3]; |
d->reg[0x0d] = ether_address[3]; |
604 |
d->reg[0x11] = ether_address[4]; |
d->reg[0x11] = ether_address[4]; |
605 |
d->reg[0x15] = ether_address[5]; |
d->reg[0x15] = ether_address[5]; |
606 |
/* TODO: 19, 1d, 21, 25 = checksum bytes 1,2,2,1 resp. */ |
/* TODO: 19, 1d, 21, 25 = checksum bytes 1,2,2,1 resp. */ |
607 |
d->reg[0x29] = ether_address[5]; |
d->reg[0x29] = ether_address[5]; |
608 |
d->reg[0x2d] = ether_address[4]; |
d->reg[0x2d] = ether_address[4]; |
609 |
d->reg[0x31] = ether_address[3]; |
d->reg[0x31] = ether_address[3]; |
610 |
d->reg[0x35] = ether_address[2]; |
d->reg[0x35] = ether_address[2]; |
611 |
d->reg[0x39] = ether_address[1]; |
d->reg[0x39] = ether_address[1]; |
612 |
d->reg[0x3d] = ether_address[1]; |
d->reg[0x3d] = ether_address[1]; |
613 |
d->reg[0x41] = ether_address[0]; |
d->reg[0x41] = ether_address[0]; |
614 |
d->reg[0x45] = ether_address[1]; |
d->reg[0x45] = ether_address[1]; |
615 |
d->reg[0x49] = ether_address[2]; |
d->reg[0x49] = ether_address[2]; |
616 |
d->reg[0x4d] = ether_address[3]; |
d->reg[0x4d] = ether_address[3]; |
617 |
d->reg[0x51] = ether_address[4]; |
d->reg[0x51] = ether_address[4]; |
618 |
d->reg[0x55] = ether_address[5]; |
d->reg[0x55] = ether_address[5]; |
619 |
/* TODO: 59, 5d = checksum bytes 1,2 resp. */ |
/* TODO: 59, 5d = checksum bytes 1,2 resp. */ |
620 |
d->reg[0x61] = 0xff; |
d->reg[0x61] = 0xff; |
621 |
d->reg[0x65] = 0x00; |
d->reg[0x65] = 0x00; |
622 |
d->reg[0x69] = 0x55; |
d->reg[0x69] = 0x55; |
623 |
d->reg[0x6d] = 0xaa; |
d->reg[0x6d] = 0xaa; |
624 |
d->reg[0x71] = 0xff; |
d->reg[0x71] = 0xff; |
625 |
d->reg[0x75] = 0x00; |
d->reg[0x75] = 0x00; |
626 |
d->reg[0x79] = 0x55; |
d->reg[0x79] = 0x55; |
627 |
d->reg[0x7d] = 0xaa; |
d->reg[0x7d] = 0xaa; |
628 |
|
|
|
/* Only SGI uses BCD format (?) */ |
|
|
d->use_bcd = 0; |
|
|
if (access_style == MC146818_SGI) |
|
|
d->use_bcd = 1; |
|
|
|
|
|
if (access_style == MC146818_DEC) { |
|
629 |
/* Battery valid, for DECstations */ |
/* Battery valid, for DECstations */ |
630 |
d->reg[0xf8] = 1; |
d->reg[0xf8] = 1; |
631 |
} |
} |