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

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

revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005-2006  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_adb.c,v 1.10 2006/07/21 16:55:41 debug Exp $   *  $Id: dev_adb.c,v 1.12 2007/01/28 11:29:52 debug Exp $
29   *   *
30   *  ADB (Apple Desktop Bus) controller.   *  ADB (Apple Desktop Bus) controller.
31   *   *
# Line 48  Line 48 
48  #include "console.h"  #include "console.h"
49  #include "cpu.h"  #include "cpu.h"
50  #include "device.h"  #include "device.h"
51    #include "interrupt.h"
52  #include "machine.h"  #include "machine.h"
53  #include "memory.h"  #include "memory.h"
54  #include "misc.h"  #include "misc.h"
# Line 75  static char *via_regname[N_VIA_REGS] = { Line 76  static char *via_regname[N_VIA_REGS] = {
76          "vPCR",  "vIFR",  "vIER",  "(unknown)" };          "vPCR",  "vIFR",  "vIER",  "(unknown)" };
77    
78  struct adb_data {  struct adb_data {
79          int             irq_nr;          struct interrupt irq;
80          int             int_asserted;          int             int_asserted;
81    
82          int             kbd_dev;          int             kbd_dev;
# Line 112  struct adb_data { Line 113  struct adb_data {
113  DEVICE_TICK(adb)  DEVICE_TICK(adb)
114  {  {
115          struct adb_data *d = extra;          struct adb_data *d = extra;
116          int a;          int assert;
117    
118          a = d->reg[vIFR >> VIA_REG_SHIFT] & IFR_ANY;          assert = d->reg[vIFR >> VIA_REG_SHIFT] & IFR_ANY;
119          if (a == IFR_ANY && d->int_enable)          if (assert == IFR_ANY && d->int_enable)
120                  a = 1;                  assert = 1;
121    
122          if (a)          if (assert)
123                  cpu_interrupt(cpu, d->irq_nr);                  INTERRUPT_ASSERT(d->irq);
124          else if (d->int_asserted)          else if (d->int_asserted)
125                  cpu_interrupt_ack(cpu, d->irq_nr);                  INTERRUPT_DEASSERT(d->irq);
126    
127          d->int_asserted = a;          d->int_asserted = assert;
128  }  }
129    
130    
# Line 444  DEVINIT(adb) Line 445  DEVINIT(adb)
445                  exit(1);                  exit(1);
446          }          }
447          memset(d, 0, sizeof(struct adb_data));          memset(d, 0, sizeof(struct adb_data));
448          d->irq_nr = devinit->irq_nr;  
449            INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);
450    
451          adb_reset(d);          adb_reset(d);
452    

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

  ViewVC Help
Powered by ViewVC 1.1.26