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

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

revision 22 by dpavlin, Mon Oct 8 16:19:37 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_8259.c,v 1.24 2006/02/09 20:02:58 debug Exp $   *  $Id: dev_8259.c,v 1.29 2006/12/30 13:30:57 debug Exp $
29   *     *  
30   *  8259 Programmable Interrupt Controller.   *  8259 Programmable Interrupt Controller.
31   *   *
# Line 51  Line 51 
51  /*  #define DEV_8259_DEBUG  */  /*  #define DEV_8259_DEBUG  */
52    
53    
 /*  
  *  dev_8259_access():  
  */  
54  DEVICE_ACCESS(8259)  DEVICE_ACCESS(8259)
55  {  {
56          struct pic8259_data *d = (struct pic8259_data *) extra;          struct pic8259_data *d = (struct pic8259_data *) extra;
# Line 113  DEVICE_ACCESS(8259) Line 110  DEVICE_ACCESS(8259)
110                                  d->isr = 0;                                  d->isr = 0;
111                                  /*  Recalculate interrupt assertions,                                  /*  Recalculate interrupt assertions,
112                                      if necessary:  */                                      if necessary:  */
113                                  if ((old_irr & ~d->ier) != (d->irr & ~d->ier))                                  if ((old_irr & ~d->ier) != (d->irr & ~d->ier)) {
114                                          cpu_interrupt(cpu, d->irq_nr);                                          if (d->irr & ~d->ier)
115                                                    INTERRUPT_ASSERT(d->irq);
116                                            else
117                                                    INTERRUPT_DEASSERT(d->irq);
118                                    }
119                          } else if ((idata >= 0x21 && idata <= 0x27) ||                          } else if ((idata >= 0x21 && idata <= 0x27) ||
120                              (idata >= 0x60 && idata <= 0x67) ||                              (idata >= 0x60 && idata <= 0x67) ||
121                              (idata >= 0xe0 && idata <= 0xe7)) {                              (idata >= 0xe0 && idata <= 0xe7)) {
# Line 123  DEVICE_ACCESS(8259) Line 124  DEVICE_ACCESS(8259)
124                                  d->irr &= ~(1 << (idata & 7));                                  d->irr &= ~(1 << (idata & 7));
125                                  d->isr &= ~(1 << (idata & 7));                                  d->isr &= ~(1 << (idata & 7));
126                                  /*  Recalc. int assertions, if necessary:  */                                  /*  Recalc. int assertions, if necessary:  */
127                                  if ((old_irr & ~d->ier) != (d->irr & ~d->ier))                                  if ((old_irr & ~d->ier) != (d->irr & ~d->ier)) {
128                                          cpu_interrupt(cpu, d->irq_nr);                                          if (d->irr & ~d->ier)
129                                                    INTERRUPT_ASSERT(d->irq);
130                                            else
131                                                    INTERRUPT_DEASSERT(d->irq);
132                                    }
133                          } else if (idata == 0x68) {                          } else if (idata == 0x68) {
134                                  /*  Set Special Mask Mode  */                                  /*  Set Special Mask Mode  */
135                                  /*  TODO  */                                  /*  TODO  */
# Line 211  DEVICE_ACCESS(8259) Line 216  DEVICE_ACCESS(8259)
216    
217                          /*  Recalculate interrupt assertions,                          /*  Recalculate interrupt assertions,
218                              if necessary:  */                              if necessary:  */
219                          if ((d->irr & ~old_ier) != (d->irr & ~d->ier))                          if ((d->irr & ~old_ier) != (d->irr & ~d->ier)) {
220                                  cpu_interrupt(cpu, d->irq_nr);                                  if (d->irr & ~d->ier)
221                                            INTERRUPT_ASSERT(d->irq);
222                                    else
223                                            INTERRUPT_DEASSERT(d->irq);
224                            }
225                  } else {                  } else {
226                          odata = d->ier;                          odata = d->ier;
227                  }                  }
# Line 260  DEVINIT(8259) Line 269  DEVINIT(8259)
269                  exit(1);                  exit(1);
270          }          }
271          memset(d, 0, sizeof(struct pic8259_data));          memset(d, 0, sizeof(struct pic8259_data));
272          d->irq_nr = devinit->irq_nr;  
273            INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);
274    
275          name2 = malloc(nlen);          name2 = malloc(nlen);
276          snprintf(name2, nlen, "%s", devinit->name);          snprintf(name2, nlen, "%s", devinit->name);

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

  ViewVC Help
Powered by ViewVC 1.1.26