27 |
* $Id: dev_openpic.c,v 1.14 2007/09/11 21:42:52 debug Exp $ |
* $Id: dev_openpic.c,v 1.14 2007/09/11 21:42:52 debug Exp $ |
28 |
* |
* |
29 |
* COMMENT: OpenPIC Interrupt controller (used by sandpoint ppc) |
* COMMENT: OpenPIC Interrupt controller (used by sandpoint ppc) |
30 |
* based on dev_openpic.c |
* based on dev_gc.c |
31 |
*/ |
*/ |
32 |
|
|
33 |
#include <stdio.h> |
#include <stdio.h> |
85 |
|
|
86 |
DEVICE_ACCESS(openpic) |
DEVICE_ACCESS(openpic) |
87 |
{ |
{ |
88 |
struct openpic_data *d = extra; |
// struct openpic_data *d = extra; |
89 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
90 |
|
|
91 |
if (writeflag == MEM_WRITE) |
if (writeflag == MEM_WRITE) |
104 |
#define INT_LEVEL_REG_L (interrupt_reg + 0x1c) |
#define INT_LEVEL_REG_L (interrupt_reg + 0x1c) |
105 |
#endif |
#endif |
106 |
|
|
107 |
|
#if 0 |
108 |
case 0x10: |
case 0x10: |
109 |
if (writeflag == MEM_READ) |
if (writeflag == MEM_READ) |
110 |
odata = d->status_hi & d->enable_hi; |
odata = d->status_hi & d->enable_hi; |
191 |
case 0x2c: |
case 0x2c: |
192 |
/* Avoid a debug message. */ |
/* Avoid a debug message. */ |
193 |
break; |
break; |
194 |
|
#endif |
195 |
default:if (writeflag == MEM_WRITE) { |
default:if (writeflag == MEM_WRITE) { |
196 |
fatal("[ openpic: unimplemented write to " |
fatal("[ openpic: unimplemented write to " |
197 |
"offset 0x%x: data=0x%x ]\n", (int) |
"offset 0x%x: data=0x%x ]\n", (int) |
221 |
INTERRUPT_CONNECT(devinit->interrupt_path, d->cpu_irq); |
INTERRUPT_CONNECT(devinit->interrupt_path, d->cpu_irq); |
222 |
|
|
223 |
/* |
/* |
224 |
* Register the 64 Grand Central interrupts (32 lo, 32 hi): |
* Register the 126 OpenPIC interrupts |
225 |
*/ |
*/ |
226 |
for (i=0; i<32; i++) { |
for (i=0; i<126; i++) { |
227 |
struct interrupt template; |
struct interrupt template; |
228 |
char n[300]; |
char n[300]; |
229 |
snprintf(n, sizeof(n), "%s.openpic.lo.%i", |
snprintf(n, sizeof(n), "%s.openpic.%i", |
230 |
devinit->interrupt_path, i); |
devinit->interrupt_path, i); |
231 |
memset(&template, 0, sizeof(template)); |
memset(&template, 0, sizeof(template)); |
232 |
template.line = 1 << i; |
template.line = 1 << i; |
235 |
template.interrupt_assert = openpic_lo_interrupt_assert; |
template.interrupt_assert = openpic_lo_interrupt_assert; |
236 |
template.interrupt_deassert = openpic_lo_interrupt_deassert; |
template.interrupt_deassert = openpic_lo_interrupt_deassert; |
237 |
interrupt_handler_register(&template); |
interrupt_handler_register(&template); |
|
|
|
|
snprintf(n, sizeof(n), "%s.openpic.hi.%i", |
|
|
devinit->interrupt_path, i); |
|
|
memset(&template, 0, sizeof(template)); |
|
|
template.line = 1 << i; |
|
|
template.name = n; |
|
|
template.extra = d; |
|
|
template.interrupt_assert = openpic_hi_interrupt_assert; |
|
|
template.interrupt_deassert = openpic_hi_interrupt_deassert; |
|
|
interrupt_handler_register(&template); |
|
238 |
} |
} |
239 |
|
|
240 |
memory_device_register(devinit->machine->memory, "openpic", |
memory_device_register(devinit->machine->memory, "openpic", |