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

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

revision 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-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_cpc700.c,v 1.3 2005/11/22 02:07:39 debug Exp $   *  $Id: dev_cpc700.c,v 1.7 2006/01/01 13:17:16 debug Exp $
29   *     *  
30   *  IBM CPC700 bridge; PCI and interrupt controller.   *  IBM CPC700 bridge; PCI and interrupt controller.
31   */   */
# Line 48  Line 48 
48  /*  /*
49   *  dev_cpc700_pci_access():   *  dev_cpc700_pci_access():
50   *   *
51   *  Passes PCI indirect addr and data accesses onto bus_pci_access().   *  Passes PCI indirect addr and data accesses onto bus_pci.
52   */   */
53  int dev_cpc700_pci_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(cpc700_pci)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
54  {  {
55          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
56            int bus, dev, func, reg;
57          struct cpc700_data *d = extra;          struct cpc700_data *d = extra;
58    
59          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
60                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN);
61    
62          relative_addr += BUS_PCI_ADDR;          switch (relative_addr) {
63            case 0: /*  Address:  */
64                    bus_pci_decompose_1(idata, &bus, &dev, &func, &reg);
65                    bus_pci_setaddr(cpu, d->pci_data, bus, dev, func, reg);
66                    break;
67    
68          if (writeflag == MEM_WRITE)          case 4: /*  Data:  */
69                  bus_pci_access(cpu, mem, relative_addr, &idata,                  bus_pci_data_access(cpu, d->pci_data, writeflag == MEM_READ?
70                      len, writeflag, d->pci_data);                      &odata : &idata, len, writeflag);
71          else                  break;
72                  bus_pci_access(cpu, mem, relative_addr, &odata,          }
                     len, writeflag, d->pci_data);  
73    
74          if (writeflag == MEM_READ)          if (writeflag == MEM_READ)
75                  memory_writemax64(cpu, data, len, odata);                  memory_writemax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN, odata);
76    
77          return 1;          return 1;
78  }  }
# Line 81  int dev_cpc700_pci_access(struct cpu *cp Line 83  int dev_cpc700_pci_access(struct cpu *cp
83   *   *
84   *  The interrupt controller.   *  The interrupt controller.
85   */   */
86  int dev_cpc700_int_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(cpc700_int)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
87  {  {
88          struct cpc700_data *d = extra;          struct cpc700_data *d = extra;
89          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 160  struct cpc700_data *dev_cpc700_init(stru Line 160  struct cpc700_data *dev_cpc700_init(stru
160    
161          /*  Register a PCI bus:  */          /*  Register a PCI bus:  */
162          d->pci_data = bus_pci_init(          d->pci_data = bus_pci_init(
163                machine,
164              0                   /*  pciirq: TODO  */,              0                   /*  pciirq: TODO  */,
165              0,                  /*  pci device io offset  */              0,                  /*  pci device io offset  */
166              0,                  /*  pci device mem offset  */              0,                  /*  pci device mem offset  */

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

  ViewVC Help
Powered by ViewVC 1.1.26