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: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_8259.c,v 1.27 2006/08/23 15:45:30 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 |
* |
* |
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)) { |
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 */ |
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 |
} |
} |
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); |