/[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 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2004-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:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_vr41xx.c,v 1.32 2005/10/26 14:37:04 debug Exp $   *  $Id: dev_vr41xx.c,v 1.37 2006/03/31 23:53:41 debug Exp $
29   *     *  
30   *  VR41xx (actually, VR4122 and VR4131) misc functions.   *  VR41xx (actually, VR4122 and VR4131) misc functions.
31   *   *
# Line 376  static uint64_t vr41xx_kiu(struct cpu *c Line 376  static uint64_t vr41xx_kiu(struct cpu *c
376          default:          default:
377                  if (writeflag == MEM_WRITE)                  if (writeflag == MEM_WRITE)
378                          debug("[ vr41xx KIU: unimplemented write to offset "                          debug("[ vr41xx KIU: unimplemented write to offset "
379                              "0x%x, data=0x%016llx ]\n", ofs, (long long)idata);                              "0x%x, data=0x%016"PRIx64" ]\n", ofs,
380                                (uint64_t) idata);
381                  else                  else
382                          debug("[ vr41xx KIU: unimplemented read from offset "                          debug("[ vr41xx KIU: unimplemented read from offset "
383                              "0x%x ]\n", ofs);                              "0x%x ]\n", ofs);
# Line 389  static uint64_t vr41xx_kiu(struct cpu *c Line 390  static uint64_t vr41xx_kiu(struct cpu *c
390  /*  /*
391   *  dev_vr41xx_access():   *  dev_vr41xx_access():
392   */   */
393  int dev_vr41xx_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(vr41xx)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
394  {  {
395          struct vr41xx_data *d = (struct vr41xx_data *) extra;          struct vr41xx_data *d = (struct vr41xx_data *) extra;
396          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 519  int dev_vr41xx_access(struct cpu *cpu, s Line 518  int dev_vr41xx_access(struct cpu *cpu, s
518          default:          default:
519                  if (writeflag == MEM_WRITE)                  if (writeflag == MEM_WRITE)
520                          debug("[ vr41xx: unimplemented write to address "                          debug("[ vr41xx: unimplemented write to address "
521                              "0x%llx, data=0x%016llx ]\n",                              "0x%"PRIx64", data=0x%016"PRIx64" ]\n",
522                              (long long)relative_addr, (long long)idata);                              (uint64_t) relative_addr, (uint64_t) idata);
523                  else                  else
524                          debug("[ vr41xx: unimplemented read from address "                          debug("[ vr41xx: unimplemented read from address "
525                              "0x%llx ]\n", (long long)relative_addr);                              "0x%"PRIx64" ]\n", (uint64_t) relative_addr);
526          }          }
527    
528  ret:  ret:
# Line 559  struct vr41xx_data *dev_vr41xx_init(stru Line 558  struct vr41xx_data *dev_vr41xx_init(stru
558    
559          /*  TODO: VRC4173 has the KIU at offset 0x100?  */          /*  TODO: VRC4173 has the KIU at offset 0x100?  */
560          d->kiu_offset = 0x180;          d->kiu_offset = 0x180;
561          d->kiu_console_handle = console_start_slave_inputonly(machine, "kiu");          d->kiu_console_handle = console_start_slave_inputonly(
562                machine, "kiu", 1);
563          d->kiu_irq_nr = VRIP_INTR_KIU;          d->kiu_irq_nr = VRIP_INTR_KIU;
564    
565          switch (cpumodel) {          switch (cpumodel) {
# Line 584  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                  snprintf(tmps, sizeof(tmps), "ns16550 irq=%i addr=0x%llx "                  snprintf(tmps, sizeof(tmps), "ns16550 irq=%i addr=0x%"PRIx64" "
595                      "name2=siu", 8+VRIP_INTR_SIU, (long long)(baseaddr+0x800));                      "name2=siu", 8+VRIP_INTR_SIU, (uint64_t) (baseaddr+0x800));
596                  device_add(machine, tmps);                  device_add(machine, tmps);
597          } else {          } else {
598                  /*  This is used by Linux and NetBSD:  */                  /*  This is used by Linux and NetBSD:  */
# Line 605  struct vr41xx_data *dev_vr41xx_init(stru Line 605  struct vr41xx_data *dev_vr41xx_init(stru
605          device_add(machine, "pcic addr=0x140003e0");          device_add(machine, "pcic addr=0x140003e0");
606    
607          machine_add_tickfunction(machine, dev_vr41xx_tick, d,          machine_add_tickfunction(machine, dev_vr41xx_tick, d,
608              DEV_VR41XX_TICKSHIFT);              DEV_VR41XX_TICKSHIFT, 0.0);
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.  */

Legend:
Removed from v.18  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26