/[gxemul]/trunk/src/devices/dev_dec5800.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_dec5800.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 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-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_dec5800.c,v 1.15 2005/02/22 06:26:10 debug Exp $   *  $Id: dev_dec5800.c,v 1.18 2006/01/01 13:17:16 debug Exp $
29   *     *  
30   *  Emulation of devices found in a DECsystem 58x0, where x is the number   *  Emulation of devices found in a DECsystem 58x0, where x is the number
31   *  of CPUs in the system. (The CPU board is called KN5800 by Ultrix.)   *  of CPUs in the system. (The CPU board is called KN5800 by Ultrix.)
# Line 73  void dev_dec5800_tick(struct cpu *cpu, v Line 73  void dev_dec5800_tick(struct cpu *cpu, v
73  /*  /*
74   *  dev_dec5800_vectors_access():   *  dev_dec5800_vectors_access():
75   */   */
76  int dev_dec5800_vectors_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(dec5800_vectors)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
77  {  {
78          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
79          struct dec5800_data *d = extra;          struct dec5800_data *d = extra;
80    
81          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
82                    idata = memory_readmax64(cpu, data, len);
83    
84          if (writeflag == MEM_READ) {          if (writeflag == MEM_READ) {
85                  /*  TODO  */                  /*  TODO  */
# Line 106  int dev_dec5800_vectors_access(struct cp Line 105  int dev_dec5800_vectors_access(struct cp
105  /*  /*
106   *  dev_dec5800_access():   *  dev_dec5800_access():
107   */   */
108  int dev_dec5800_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(dec5800)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
109  {  {
110          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
111          struct dec5800_data *d = extra;          struct dec5800_data *d = extra;
112    
113          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
114                    idata = memory_readmax64(cpu, data, len);
115    
116          /*  Lowest 4 bits of csr contain cpu id:  */          /*  Lowest 4 bits of csr contain cpu id:  */
117          d->csr = (d->csr & ~0xf) | (cpu->cpu_id & 0xf);          d->csr = (d->csr & ~0xf) | (cpu->cpu_id & 0xf);
# Line 169  struct dec5800_data *dev_dec5800_init(st Line 167  struct dec5800_data *dev_dec5800_init(st
167          memset(d, 0, sizeof(struct dec5800_data));          memset(d, 0, sizeof(struct dec5800_data));
168    
169          memory_device_register(mem, "dec5800", baseaddr,          memory_device_register(mem, "dec5800", baseaddr,
170              DEV_DEC5800_LENGTH, dev_dec5800_access, d, MEM_DEFAULT, NULL);              DEV_DEC5800_LENGTH, dev_dec5800_access, d, DM_DEFAULT, NULL);
171          memory_device_register(mem, "dec5800_vectors",          memory_device_register(mem, "dec5800_vectors",
172              baseaddr + 0x30000000, 0x100, dev_dec5800_vectors_access,              baseaddr + 0x30000000, 0x100, dev_dec5800_vectors_access,
173              d, MEM_DEFAULT, NULL);              d, DM_DEFAULT, NULL);
174          machine_add_tickfunction(machine, dev_dec5800_tick, d, 14);          machine_add_tickfunction(machine, dev_dec5800_tick, d, 14);
175    
176          return d;          return d;
# Line 192  struct decbi_data { Line 190  struct decbi_data {
190  /*  /*
191   *  dev_decbi_access():   *  dev_decbi_access():
192   */   */
193  int dev_decbi_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(decbi)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
194  {  {
195          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
196          int node_nr;          int node_nr;
197          struct decbi_data *d = extra;          struct decbi_data *d = extra;
198    
199          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
200                    idata = memory_readmax64(cpu, data, len);
201    
202          relative_addr += BI_NODESIZE;   /*  HACK  */          relative_addr += BI_NODESIZE;   /*  HACK  */
203    
# Line 290  void dev_decbi_init(struct memory *mem, Line 287  void dev_decbi_init(struct memory *mem,
287          memset(d, 0, sizeof(struct decbi_data));          memset(d, 0, sizeof(struct decbi_data));
288    
289          memory_device_register(mem, "decbi", baseaddr + 0x2000,          memory_device_register(mem, "decbi", baseaddr + 0x2000,
290              DEV_DECBI_LENGTH - 0x2000, dev_decbi_access, d, MEM_DEFAULT, NULL);              DEV_DECBI_LENGTH - 0x2000, dev_decbi_access, d, DM_DEFAULT, NULL);
291  }  }
292    
293    
# Line 309  struct deccca_data { Line 306  struct deccca_data {
306  /*  /*
307   *  dev_deccca_access():   *  dev_deccca_access():
308   */   */
309  int dev_deccca_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(deccca)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
310  {  {
311          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
312          /*  struct deccca_data *d = extra;  */          /*  struct deccca_data *d = extra;  */
313    
314          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
315                    idata = memory_readmax64(cpu, data, len);
316    
317          switch (relative_addr) {          switch (relative_addr) {
318          case 6:          case 6:
# Line 371  void dev_deccca_init(struct memory *mem, Line 367  void dev_deccca_init(struct memory *mem,
367          memset(d, 0, sizeof(struct deccca_data));          memset(d, 0, sizeof(struct deccca_data));
368    
369          memory_device_register(mem, "deccca", baseaddr, DEV_DECCCA_LENGTH,          memory_device_register(mem, "deccca", baseaddr, DEV_DECCCA_LENGTH,
370              dev_deccca_access, d, MEM_DEFAULT, NULL);              dev_deccca_access, d, DM_DEFAULT, NULL);
371  }  }
372    
373    
# Line 392  struct decxmi_data { Line 388  struct decxmi_data {
388  /*  /*
389   *  dev_decxmi_access():   *  dev_decxmi_access():
390   */   */
391  int dev_decxmi_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(decxmi)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
392  {  {
393          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
394          int node_nr;          int node_nr;
395          struct decxmi_data *d = extra;          struct decxmi_data *d = extra;
396    
397          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
398                    idata = memory_readmax64(cpu, data, len);
399    
400          node_nr = relative_addr / XMI_NODESIZE;          node_nr = relative_addr / XMI_NODESIZE;
401          relative_addr &= (XMI_NODESIZE - 1);          relative_addr &= (XMI_NODESIZE - 1);
# Line 488  void dev_decxmi_init(struct memory *mem, Line 483  void dev_decxmi_init(struct memory *mem,
483          memset(d, 0, sizeof(struct decxmi_data));          memset(d, 0, sizeof(struct decxmi_data));
484    
485          memory_device_register(mem, "decxmi", baseaddr, DEV_DECXMI_LENGTH,          memory_device_register(mem, "decxmi", baseaddr, DEV_DECXMI_LENGTH,
486              dev_decxmi_access, d, MEM_DEFAULT, NULL);              dev_decxmi_access, d, DM_DEFAULT, NULL);
487  }  }
488    

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

  ViewVC Help
Powered by ViewVC 1.1.26