1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_mc146818.c,v 1.80 2005/11/20 11:28:45 debug Exp $ |
* $Id: dev_mc146818.c,v 1.84 2006/01/17 05:55:53 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 other machines is also similar to the MC146818.) |
* (DS1687 as used in some other machines is also similar to the MC146818.) |
319 |
struct tm *tmp; |
struct tm *tmp; |
320 |
time_t timet; |
time_t timet; |
321 |
struct mc_data *d = extra; |
struct mc_data *d = extra; |
322 |
int i, relative_addr = r; |
int relative_addr = r; |
323 |
|
size_t i; |
324 |
|
|
325 |
relative_addr /= d->addrdiv; |
relative_addr /= d->addrdiv; |
326 |
|
|
507 |
case 0x128: |
case 0x128: |
508 |
d->reg[relative_addr] = data[0]; |
d->reg[relative_addr] = data[0]; |
509 |
if (data[0] & 8) { |
if (data[0] & 8) { |
510 |
|
int j; |
511 |
|
|
512 |
/* Used on SGI to power off the machine. */ |
/* Used on SGI to power off the machine. */ |
513 |
fatal("[ md146818: power off ]\n"); |
fatal("[ md146818: power off ]\n"); |
514 |
for (i=0; i<cpu->machine->ncpus; i++) |
for (j=0; j<cpu->machine->ncpus; j++) |
515 |
cpu->machine->cpus[i]->running = 0; |
cpu->machine->cpus[j]->running = 0; |
516 |
cpu->machine-> |
cpu->machine-> |
517 |
exit_without_entering_debugger = 1; |
exit_without_entering_debugger = 1; |
518 |
} |
} |
642 |
|
|
643 |
if (machine->machine_type != MACHINE_PREP) { |
if (machine->machine_type != MACHINE_PREP) { |
644 |
/* NetBSD/prep has a really ugly clock detection code; |
/* NetBSD/prep has a really ugly clock detection code; |
645 |
all other machines/OSes don't need this. */ |
no other machines/OSes don't need this. */ |
646 |
d->ugly_netbsd_prep_hack_done = NETBSD_HACK_DONE; |
d->ugly_netbsd_prep_hack_done = NETBSD_HACK_DONE; |
647 |
} |
} |
648 |
|
|
693 |
* TODO: Find out if this messes up Sprite emulation; if so, then |
* TODO: Find out if this messes up Sprite emulation; if so, then |
694 |
* this hack has to be removed. |
* this hack has to be removed. |
695 |
*/ |
*/ |
696 |
d->uip_threshold = 5; |
d->uip_threshold = 8; |
697 |
|
|
698 |
if (access_style == MC146818_ARC_JAZZ) |
if (access_style == MC146818_ARC_JAZZ) |
699 |
memory_device_register(mem, "mc146818_jazz", 0x90000070ULL, |
memory_device_register(mem, "mc146818_jazz", 0x90000070ULL, |