25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_ps2_stuff.c,v 1.31 2007/02/16 16:48:07 debug Exp $ |
* $Id: dev_ps2_stuff.c,v 1.33 2007/06/15 19:57:33 debug Exp $ |
29 |
* |
* |
30 |
* Playstation 2 misc. stuff: |
* COMMENT: PlayStation 2 misc stuff (timer, DMA, interrupts, ...) |
31 |
* |
* |
32 |
* offset 0x0000 timer control |
* offset 0x0000 timer control |
33 |
* offset 0x8000 DMA controller |
* offset 0x8000 DMA controller |
271 |
d->dmac_reg[D2_MADR_REG/0x10], |
d->dmac_reg[D2_MADR_REG/0x10], |
272 |
(long)length); |
(long)length); |
273 |
|
|
274 |
copy_buf = malloc(length); |
CHECK_ALLOCATION(copy_buf = malloc(length)); |
275 |
if (copy_buf == NULL) { |
|
|
fprintf(stderr, "out of memory in " |
|
|
"dev_ps2_access()\n"); |
|
|
exit(1); |
|
|
} |
|
276 |
cpu->memory_rw(cpu, cpu->mem, from_addr, |
cpu->memory_rw(cpu, cpu->mem, from_addr, |
277 |
copy_buf, length, MEM_READ, |
copy_buf, length, MEM_READ, |
278 |
CACHE_NONE | PHYSICAL); |
CACHE_NONE | PHYSICAL); |
395 |
struct interrupt template; |
struct interrupt template; |
396 |
char n[300]; |
char n[300]; |
397 |
|
|
398 |
d = malloc(sizeof(struct ps2_data)); |
CHECK_ALLOCATION(d = malloc(sizeof(struct ps2_data))); |
|
if (d == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
399 |
memset(d, 0, sizeof(struct ps2_data)); |
memset(d, 0, sizeof(struct ps2_data)); |
400 |
|
|
401 |
d->other_memory_base[DMA_CH_GIF] = DEV_PS2_GIF_FAKE_BASE; |
d->other_memory_base[DMA_CH_GIF] = DEV_PS2_GIF_FAKE_BASE; |
466 |
memory_device_register(devinit->machine->memory, "ps2", devinit->addr, |
memory_device_register(devinit->machine->memory, "ps2", devinit->addr, |
467 |
DEV_PS2_LENGTH, dev_ps2_access, d, DM_DEFAULT, NULL); |
DEV_PS2_LENGTH, dev_ps2_access, d, DM_DEFAULT, NULL); |
468 |
machine_add_tickfunction(devinit->machine, |
machine_add_tickfunction(devinit->machine, |
469 |
dev_ps2_tick, d, TICK_STEPS_SHIFT, 0.0); |
dev_ps2_tick, d, TICK_STEPS_SHIFT); |
470 |
|
|
471 |
return 1; |
return 1; |
472 |
} |
} |