/[gxemul]/trunk/src/devices/dev_ps2_stuff.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_ps2_stuff.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
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
# Line 271  DEVICE_ACCESS(ps2) Line 271  DEVICE_ACCESS(ps2)
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);
# Line 399  DEVINIT(ps2) Line 395  DEVINIT(ps2)
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;
# Line 474  DEVINIT(ps2) Line 466  DEVINIT(ps2)
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  }  }

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26