/[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 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_cpc700.c,v 1.10 2007/01/29 19:03:16 debug Exp $   *  $Id: dev_cpc700.c,v 1.12 2007/06/15 18:13:04 debug Exp $
29   *     *
30   *  IBM CPC700 bridge; PCI and interrupt controller.   *  COMMENT: IBM CPC700 bridge (PCI and interrupt controller)
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 37  Line 37 
37  #include "bus_pci.h"  #include "bus_pci.h"
38  #include "cpu.h"  #include "cpu.h"
39  #include "device.h"  #include "device.h"
40    #include "interrupt.h"
41  #include "machine.h"  #include "machine.h"
42  #include "memory.h"  #include "memory.h"
43  #include "misc.h"  #include "misc.h"
# Line 57  struct cpc700_data { Line 58  struct cpc700_data {
58  void cpc700_interrupt_assert(struct interrupt *interrupt)  void cpc700_interrupt_assert(struct interrupt *interrupt)
59  {  {
60          struct cpc700_data *d = interrupt->extra;          struct cpc700_data *d = interrupt->extra;
61          d->sr |= (1 << interrupt->line);          d->sr |= interrupt->line;
62          if (d->sr & d->er)          if (d->sr & d->er)
63                  INTERRUPT_ASSERT(d->ppc_irq);                  INTERRUPT_ASSERT(d->ppc_irq);
64  }  }
65  void cpc700_interrupt_deassert(struct interrupt *interrupt)  void cpc700_interrupt_deassert(struct interrupt *interrupt)
66  {  {
67          struct cpc700_data *d = interrupt->extra;          struct cpc700_data *d = interrupt->extra;
68          d->sr &= ~(1 << interrupt->line);          d->sr &= ~interrupt->line;
69          if (!(d->sr & d->er))          if (!(d->sr & d->er))
70                  INTERRUPT_DEASSERT(d->ppc_irq);                  INTERRUPT_DEASSERT(d->ppc_irq);
71  }  }
# Line 188  DEVINIT(cpc700) Line 189  DEVINIT(cpc700)
189          char tmp[300];          char tmp[300];
190          int i;          int i;
191    
192          d = malloc(sizeof(struct cpc700_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct cpc700_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
193          memset(d, 0, sizeof(struct cpc700_data));          memset(d, 0, sizeof(struct cpc700_data));
194    
195          /*  Connect to the CPU's interrupt pin:  */          /*  Connect to the CPU's interrupt pin:  */
# Line 205  DEVINIT(cpc700) Line 202  DEVINIT(cpc700)
202                  snprintf(n, sizeof(n), "%s.cpc700.%i",                  snprintf(n, sizeof(n), "%s.cpc700.%i",
203                      devinit->interrupt_path, i);                      devinit->interrupt_path, i);
204                  memset(&template, 0, sizeof(template));                  memset(&template, 0, sizeof(template));
205                  template.line = i;                  template.line = 1 << i;
206                  template.name = n;                  template.name = n;
207                  template.extra = d;                  template.extra = d;
208                  template.interrupt_assert = cpc700_interrupt_assert;                  template.interrupt_assert = cpc700_interrupt_assert;

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

  ViewVC Help
Powered by ViewVC 1.1.26