/[gxemul]/trunk/src/devices/dev_vr41xx.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_vr41xx.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_vr41xx.c,v 1.43 2007/01/21 21:02:57 debug Exp $   *  $Id: dev_vr41xx.c,v 1.46 2007/06/15 19:57:34 debug Exp $
29   *     *  
30   *  VR41xx (VR4122 and VR4131) misc functions.   *  COMMENT: VR41xx (VR4122 and VR4131) misc functions
31   *   *
32   *  This is just a big hack.   *  This is just a big hack.
33   *   *
# Line 394  static void vr41xx_keytick(struct cpu *c Line 394  static void vr41xx_keytick(struct cpu *c
394   */   */
395  static void timer_tick(struct timer *timer, void *extra)  static void timer_tick(struct timer *timer, void *extra)
396  {  {
397          struct vr41xx_data *d = (struct vr41xx_data *) extra;          struct vr41xx_data *d = extra;
398          d->pending_timer_interrupts ++;          d->pending_timer_interrupts ++;
399  }  }
400    
# Line 406  DEVICE_TICK(vr41xx) Line 406  DEVICE_TICK(vr41xx)
406          if (d->pending_timer_interrupts > 0)          if (d->pending_timer_interrupts > 0)
407                  INTERRUPT_ASSERT(d->timer_irq);                  INTERRUPT_ASSERT(d->timer_irq);
408    
409          if (cpu->machine->use_x11)          if (cpu->machine->x11_md.in_use)
410                  vr41xx_keytick(cpu, d);                  vr41xx_keytick(cpu, d);
411  }  }
412    
# Line 481  static uint64_t vr41xx_kiu(struct cpu *c Line 481  static uint64_t vr41xx_kiu(struct cpu *c
481    
482  DEVICE_ACCESS(vr41xx)  DEVICE_ACCESS(vr41xx)
483  {  {
484          struct vr41xx_data *d = (struct vr41xx_data *) extra;          struct vr41xx_data *d = extra;
485          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
486          int regnr;          int regnr;
487          int revision = 0;          int revision = 0;
# Line 674  ret: Line 674  ret:
674  struct vr41xx_data *dev_vr41xx_init(struct machine *machine,  struct vr41xx_data *dev_vr41xx_init(struct machine *machine,
675          struct memory *mem, int cpumodel)          struct memory *mem, int cpumodel)
676  {  {
677            struct vr41xx_data *d;
678          uint64_t baseaddr = 0;          uint64_t baseaddr = 0;
679          char tmps[300];          char tmps[300];
680          int i;          int i;
         struct vr41xx_data *d = malloc(sizeof(struct vr41xx_data));  
681    
682          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct vr41xx_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
683          memset(d, 0, sizeof(struct vr41xx_data));          memset(d, 0, sizeof(struct vr41xx_data));
684    
685          /*  Connect to MIPS irq 2:  */          /*  Connect to MIPS irq 2:  */
# Line 737  struct vr41xx_data *dev_vr41xx_init(stru Line 734  struct vr41xx_data *dev_vr41xx_init(stru
734              machine->path, machine->bootstrap_cpu, VRIP_INTR_KIU);              machine->path, machine->bootstrap_cpu, VRIP_INTR_KIU);
735          INTERRUPT_CONNECT(tmps, d->kiu_irq);          INTERRUPT_CONNECT(tmps, d->kiu_irq);
736    
737          if (machine->use_x11)          if (machine->x11_md.in_use)
738                  machine->main_console_handle = d->kiu_console_handle;                    machine->main_console_handle = d->kiu_console_handle;  
739    
740          switch (cpumodel) {          switch (cpumodel) {
# Line 797  struct vr41xx_data *dev_vr41xx_init(stru Line 794  struct vr41xx_data *dev_vr41xx_init(stru
794          device_add(machine, tmps);          device_add(machine, tmps);
795    
796          machine_add_tickfunction(machine, dev_vr41xx_tick, d,          machine_add_tickfunction(machine, dev_vr41xx_tick, d,
797              DEV_VR41XX_TICKSHIFT, 0.0);              DEV_VR41XX_TICKSHIFT);
798    
799          /*  Some machines (?) use ISA space at 0x15000000 instead of          /*  Some machines (?) use ISA space at 0x15000000 instead of
800              0x14000000, eg IBM WorkPad Z50.  */              0x14000000, eg IBM WorkPad Z50.  */

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

  ViewVC Help
Powered by ViewVC 1.1.26