/[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 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_vr41xx.c,v 1.29 2005/04/09 12:11:46 debug Exp $   *  $Id: dev_vr41xx.c,v 1.33 2005/11/13 00:14:10 debug Exp $
29   *     *  
30   *  VR41xx (actually, VR4122 and VR4131) misc functions.   *  VR41xx (actually, VR4122 and VR4131) misc functions.
31   *   *
# Line 398  int dev_vr41xx_access(struct cpu *cpu, s Line 398  int dev_vr41xx_access(struct cpu *cpu, s
398          int regnr;          int regnr;
399          int revision = 0;          int revision = 0;
400    
401          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
402                    idata = memory_readmax64(cpu, data, len);
403    
404          regnr = relative_addr / sizeof(uint64_t);          regnr = relative_addr / sizeof(uint64_t);
405    
406          /*  KIU ("Keyboard Interface Unit") is handled separately.  */          /*  KIU ("Keyboard Interface Unit") is handled separately.  */
# Line 544  struct vr41xx_data *dev_vr41xx_init(stru Line 546  struct vr41xx_data *dev_vr41xx_init(stru
546          struct memory *mem, int cpumodel)          struct memory *mem, int cpumodel)
547  {  {
548          uint64_t baseaddr = 0;          uint64_t baseaddr = 0;
549            char tmps[100];
550          struct vr41xx_data *d = malloc(sizeof(struct vr41xx_data));          struct vr41xx_data *d = malloc(sizeof(struct vr41xx_data));
551    
552          if (d == NULL) {          if (d == NULL) {
553                  fprintf(stderr, "out of memory\n");                  fprintf(stderr, "out of memory\n");
554                  exit(1);                  exit(1);
# Line 567  struct vr41xx_data *dev_vr41xx_init(stru Line 571  struct vr41xx_data *dev_vr41xx_init(stru
571                  break;                  break;
572          case 4181:          case 4181:
573                  baseaddr = 0xa000000;                  baseaddr = 0xa000000;
574                  dev_ram_init(mem, 0xb000000, 0x1000000, DEV_RAM_MIRROR,                  dev_ram_init(machine, 0xb000000, 0x1000000, DEV_RAM_MIRROR,
575                      0xa000000);                      0xa000000);
576                  break;                  break;
577          case 4122:          case 4122:
# Line 580  struct vr41xx_data *dev_vr41xx_init(stru Line 584  struct vr41xx_data *dev_vr41xx_init(stru
584          }          }
585    
586          memory_device_register(mem, "vr41xx", baseaddr, DEV_VR41XX_LENGTH,          memory_device_register(mem, "vr41xx", baseaddr, DEV_VR41XX_LENGTH,
587              dev_vr41xx_access, (void *)d, MEM_DEFAULT, NULL);              dev_vr41xx_access, (void *)d, DM_DEFAULT, NULL);
588    
589          /*          /*
590           *  TODO: Find out which controllers are at which addresses on           *  TODO: Find out which controllers are at which addresses on
591           *  which chips.           *  which chips.
592           */           */
593          if (cpumodel == 4131) {          if (cpumodel == 4131) {
594                  dev_ns16550_init(machine, mem, baseaddr + 0x800,                  snprintf(tmps, sizeof(tmps), "ns16550 irq=%i addr=0x%llx "
595                      8 + VRIP_INTR_SIU, 1, 1, "vr41xx siu");                      "name2=siu", 8+VRIP_INTR_SIU, (long long)(baseaddr+0x800));
596                    device_add(machine, tmps);
597          } else {          } else {
598                  /*  This is used by Linux and NetBSD:  */                  /*  This is used by Linux and NetBSD:  */
599                  dev_ns16550_init(machine, mem, 0xc000000,                  snprintf(tmps, sizeof(tmps), "ns16550 irq=%i addr=0x%x "
600                      8 + VRIP_INTR_SIU, 1, 1, "vr41xx serial");                      "name2=serial", 8+VRIP_INTR_SIU, 0xc000000);
601                    device_add(machine, tmps);
602          }          }
603    
604          /*  Hm... maybe this should not be here.  TODO  */          /*  Hm... maybe this should not be here.  TODO  */
# Line 603  struct vr41xx_data *dev_vr41xx_init(stru Line 609  struct vr41xx_data *dev_vr41xx_init(stru
609    
610          /*  Some machines (?) use ISA space at 0x15000000 instead of          /*  Some machines (?) use ISA space at 0x15000000 instead of
611              0x14000000, eg IBM WorkPad Z50.  */              0x14000000, eg IBM WorkPad Z50.  */
612          dev_ram_init(mem, 0x15000000, 0x1000000, DEV_RAM_MIRROR, 0x14000000);          dev_ram_init(machine, 0x15000000, 0x1000000, DEV_RAM_MIRROR,
613                0x14000000);
614    
615          return d;          return d;
616  }  }

Legend:
Removed from v.4  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26