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

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

revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-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_prep.c,v 1.1 2005/11/21 09:17:26 debug Exp $   *  $Id: dev_prep.c,v 1.10 2007/02/11 10:03:55 debug Exp $
29   *   *
30   *  PReP interrupt controller.   *  PReP mainbus.
31     *
32     *  o)  ISA bus
33     *  o)  Interrupt controller
34   */   */
35    
36  #include <stdio.h>  #include <stdio.h>
37  #include <stdlib.h>  #include <stdlib.h>
38  #include <string.h>  #include <string.h>
39    
40    #include "bus_isa.h"
41  #include "cpu.h"  #include "cpu.h"
42  #include "device.h"  #include "device.h"
 #include "devices.h"  
43  #include "machine.h"  #include "machine.h"
44  #include "memory.h"  #include "memory.h"
45  #include "misc.h"  #include "misc.h"
46    
47    
48  /*  struct prep_data {
49   *  dev_prep_access():          uint32_t                int_status;
50   */  };
51  int dev_prep_access(struct cpu *cpu, struct memory *mem,  
52          uint64_t relative_addr, unsigned char *data, size_t len, int writeflag,  
53          void *extra)  DEVICE_ACCESS(prep)
54  {  {
55          /*  struct prep_data *d = extra;  */          /*  struct prep_data *d = extra;  */
56          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 55  int dev_prep_access(struct cpu *cpu, str Line 58  int dev_prep_access(struct cpu *cpu, str
58          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
59                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
60    
61          if (writeflag == MEM_READ)          if (writeflag == MEM_READ) {
62                  odata = cpu->machine->isa_pic_data.last_int;                  odata = cpu->machine->isa_pic_data.last_int;
63          else          } else {
64                  fatal("[ prep: write to interrupt register? ]\n");                  fatal("[ prep: write to interrupt register? ]\n");
65            }
66    
67          if (writeflag == MEM_READ)          if (writeflag == MEM_READ)
68                  memory_writemax64(cpu, data, len, odata);                  memory_writemax64(cpu, data, len, odata);
# Line 67  int dev_prep_access(struct cpu *cpu, str Line 71  int dev_prep_access(struct cpu *cpu, str
71  }  }
72    
73    
74  /*  DEVINIT(prep)
  *  devinit_prep():  
  */  
 int devinit_prep(struct devinit *devinit)  
75  {  {
76          struct prep_data *d;          struct prep_data *d;
77    
# Line 82  int devinit_prep(struct devinit *devinit Line 83  int devinit_prep(struct devinit *devinit
83          memset(d, 0, sizeof(struct prep_data));          memset(d, 0, sizeof(struct prep_data));
84    
85          memory_device_register(devinit->machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,
86              0xbffffff0, 1, dev_prep_access, d, DM_DEFAULT, NULL);              0xbffff000, 0x1000, dev_prep_access, d, DM_DEFAULT, NULL);
87    
88          devinit->return_ptr = d;          /*  This works for at least the IBM 6050:  */
89            bus_isa_init(devinit->machine, devinit->interrupt_path,
90                BUS_ISA_IDE0 | BUS_ISA_IDE1, 0x80000000, 0xc0000000);
91    
92          return 1;          return 1;
93  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26