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

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

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_sgi_ip22.c,v 1.30 2007/01/28 14:15:30 debug Exp $   *  $Id: dev_sgi_ip22.c,v 1.33 2007/06/15 19:57:34 debug Exp $
29   *     *  
30   *  SGI IP22 stuff.   *  COMMENT: SGI IP22 stuff
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 46  Line 46 
46  #define SGI_IP22_TICK_SHIFT             14  #define SGI_IP22_TICK_SHIFT             14
47    
48    
49  /*  DEVICE_TICK(sgi_ip22)
  *  dev_sgi_ip22_tick():  
  */  
 void dev_sgi_ip22_tick(struct cpu *cpu, void *extra)  
50  {  {
51          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
52    
53          if (d->reg[0x38 / 4] != 0)          if (d->reg[0x38 / 4] != 0)
54                  d->reg[0x38 / 4] --;                  d->reg[0x38 / 4] --;
# Line 65  void dev_sgi_ip22_tick(struct cpu *cpu, Line 62  void dev_sgi_ip22_tick(struct cpu *cpu,
62   */   */
63  DEVICE_ACCESS(sgi_ip22_imc)  DEVICE_ACCESS(sgi_ip22_imc)
64  {  {
65          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
66          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
67          int regnr;          int regnr;
68    
# Line 169  DEVICE_ACCESS(sgi_ip22_imc) Line 166  DEVICE_ACCESS(sgi_ip22_imc)
166   */   */
167  DEVICE_ACCESS(sgi_ip22_unknown)  DEVICE_ACCESS(sgi_ip22_unknown)
168  {  {
169          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
170          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
171    
172          idata = memory_readmax64(cpu, data, len);          idata = memory_readmax64(cpu, data, len);
# Line 212  DEVICE_ACCESS(sgi_ip22_unknown) Line 209  DEVICE_ACCESS(sgi_ip22_unknown)
209   */   */
210  DEVICE_ACCESS(sgi_ip22_unknown2)  DEVICE_ACCESS(sgi_ip22_unknown2)
211  {  {
212          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
213          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
214          int regnr;          int regnr;
215    
# Line 244  DEVICE_ACCESS(sgi_ip22_unknown2) Line 241  DEVICE_ACCESS(sgi_ip22_unknown2)
241  }  }
242    
243    
 /*  
  *  dev_sgi_ip22_sysid_access():  
  */  
244  DEVICE_ACCESS(sgi_ip22_sysid)  DEVICE_ACCESS(sgi_ip22_sysid)
245  {  {
246          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
247          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
248    
249          idata = memory_readmax64(cpu, data, len);          idata = memory_readmax64(cpu, data, len);
# Line 281  DEVICE_ACCESS(sgi_ip22_sysid) Line 275  DEVICE_ACCESS(sgi_ip22_sysid)
275  }  }
276    
277    
 /*  
  *  dev_sgi_ip22_access():  
  */  
278  DEVICE_ACCESS(sgi_ip22)  DEVICE_ACCESS(sgi_ip22)
279  {  {
280          struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra;          struct sgi_ip22_data *d = extra;
281          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
282          int regnr;          int regnr;
283    
# Line 325  fatal("TODO: ip22 legacy interrupt rewri Line 316  fatal("TODO: ip22 legacy interrupt rewri
316  abort();  abort();
317    
318  //                      cpu_interrupt_ack(cpu, 8 + 63);  //                      cpu_interrupt_ack(cpu, 8 + 63);
319                          debug("[ sgi_ip22: write to local0 IRQ MASK, "  //                      debug("[ sgi_ip22: write to local0 IRQ MASK, "
320                              "data=0x%llx ]\n", (long long)idata);  //                          "data=0x%llx ]\n", (long long)idata);
321                  } else {                  } else {
322                          debug("[ sgi_ip22: read from local0 IRQ MASK, "                          debug("[ sgi_ip22: read from local0 IRQ MASK, "
323                              "data=0x%llx ]\n", (long long)odata);                              "data=0x%llx ]\n", (long long)odata);
# Line 348  abort(); Line 339  abort();
339  fatal("TODO: ip22 legacy interrupt rewrite!\n");  fatal("TODO: ip22 legacy interrupt rewrite!\n");
340  abort();  abort();
341  //                      cpu_interrupt_ack(cpu, 8 + 63);  //                      cpu_interrupt_ack(cpu, 8 + 63);
342                          debug("[ sgi_ip22: write to local1 IRQ MASK, "  //                      debug("[ sgi_ip22: write to local1 IRQ MASK, "
343                              "data=0x%llx ]\n", (long long)idata);  //                          "data=0x%llx ]\n", (long long)idata);
344                  } else {                  } else {
345                          debug("[ sgi_ip22: read from local1 IRQ MASK, "                          debug("[ sgi_ip22: read from local1 IRQ MASK, "
346                              "data=0x%llx ]\n", (long long)odata);                              "data=0x%llx ]\n", (long long)odata);
# Line 416  abort(); Line 407  abort();
407  }  }
408    
409    
 /*  
  *  dev_sgi_ip22_init():  
  */  
410  struct sgi_ip22_data *dev_sgi_ip22_init(struct machine *machine,  struct sgi_ip22_data *dev_sgi_ip22_init(struct machine *machine,
411          struct memory *mem, uint64_t baseaddr, int guiness_flag)          struct memory *mem, uint64_t baseaddr, int guiness_flag)
412  {  {
413          struct sgi_ip22_data *d = malloc(sizeof(struct sgi_ip22_data));          struct sgi_ip22_data *d;
414          if (d == NULL) {  
415                  fprintf(stderr, "out of memory\n");          CHECK_ALLOCATION(d = malloc(sizeof(struct sgi_ip22_data)));
                 exit(1);  
         }  
416          memset(d, 0, sizeof(struct sgi_ip22_data));          memset(d, 0, sizeof(struct sgi_ip22_data));
417    
418          d->guiness_flag = guiness_flag;          d->guiness_flag = guiness_flag;
419    
420          memory_device_register(mem, "sgi_ip22", baseaddr, DEV_SGI_IP22_LENGTH,          memory_device_register(mem, "sgi_ip22", baseaddr, DEV_SGI_IP22_LENGTH,
# Line 444  struct sgi_ip22_data *dev_sgi_ip22_init( Line 431  struct sgi_ip22_data *dev_sgi_ip22_init(
431              (void *)d, DM_DEFAULT, NULL);              (void *)d, DM_DEFAULT, NULL);
432    
433          machine_add_tickfunction(machine, dev_sgi_ip22_tick, d,          machine_add_tickfunction(machine, dev_sgi_ip22_tick, d,
434              SGI_IP22_TICK_SHIFT, 0.0);              SGI_IP22_TICK_SHIFT);
435    
436          return d;          return d;
437  }  }

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26