/[gxemul]/trunk/src/devices/dev_ps2_spd.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_spd.c

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

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2004-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2004-2007  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_ps2_spd.c,v 1.14 2006/01/01 13:17:17 debug Exp $   *  $Id: dev_ps2_spd.c,v 1.16 2007/01/28 00:41:17 debug Exp $
29   *     *  
30   *  Playstation 2 "SPD" harddisk controller.   *  Playstation 2 "SPD" harddisk controller.
31   *   *
# Line 38  Line 38 
38    
39  #include "cpu.h"  #include "cpu.h"
40  #include "device.h"  #include "device.h"
41  #include "devices.h"  #include "machine.h"
42  #include "memory.h"  #include "memory.h"
43  #include "misc.h"  #include "misc.h"
44    
45    
46    #define DEV_PS2_SPD_LENGTH              0x800
47    
48    
49  struct ps2_spd_data {  struct ps2_spd_data {
50          uint64_t                wdcaddr;          uint64_t                wdcaddr;
51  };  };
52    
53    
 /*  
  *  dev_ps2_spd_access():  
  */  
54  DEVICE_ACCESS(ps2_spd)  DEVICE_ACCESS(ps2_spd)
55  {  {
56          struct ps2_spd_data *d = extra;          struct ps2_spd_data *d = extra;
# Line 94  DEVICE_ACCESS(ps2_spd) Line 94  DEVICE_ACCESS(ps2_spd)
94  }  }
95    
96    
97  /*  DEVINIT(ps2_spd)
  *  dev_ps2_spd_init():  
  */  
 void dev_ps2_spd_init(struct machine *machine, struct memory *mem,  
         uint64_t baseaddr)  
98  {  {
99          struct ps2_spd_data *d;          struct ps2_spd_data *d;
100          char tmpstr[200];          char tmpstr[200];
# Line 109  void dev_ps2_spd_init(struct machine *ma Line 105  void dev_ps2_spd_init(struct machine *ma
105                  exit(1);                  exit(1);
106          }          }
107          memset(d, 0, sizeof(struct ps2_spd_data));          memset(d, 0, sizeof(struct ps2_spd_data));
108          d->wdcaddr = baseaddr + DEV_PS2_SPD_LENGTH;          d->wdcaddr = devinit->addr + DEV_PS2_SPD_LENGTH;
109    
110          memory_device_register(mem, "ps2_spd", baseaddr, DEV_PS2_SPD_LENGTH,          memory_device_register(devinit->machine->memory, "ps2_spd",
111                devinit->addr, DEV_PS2_SPD_LENGTH,
112              dev_ps2_spd_access, d, DM_DEFAULT, NULL);              dev_ps2_spd_access, d, DM_DEFAULT, NULL);
113    
114          /*  Register a generic wdc device at a bogus address:  */          /*  Register a generic wdc device at a bogus address:  */
115          /*  (irq 8 + 32 + 0 means SBUS/PCMCIA)  */          /*  IRQ = PS2 SBUS irq 0  */
116          snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i",          snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%s.ps2_sbus.0",
117              (long long)d->wdcaddr, 8 + 32 + 0);              (long long)d->wdcaddr, devinit->interrupt_path);
118          device_add(machine, tmpstr);          device_add(devinit->machine, tmpstr);
119    
120            return 1;
121  }  }
122    

Legend:
Removed from v.22  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26