1 |
/* |
/* |
2 |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-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_bt459.c,v 1.65 2006/07/23 14:37:34 debug Exp $ |
* $Id: dev_bt459.c,v 1.67 2006/12/30 13:30:57 debug Exp $ |
29 |
* |
* |
30 |
* Brooktree 459 vdac, used by TURBOchannel graphics cards. |
* Brooktree 459 vdac, used by TURBOchannel graphics cards. |
31 |
*/ |
*/ |
65 |
int planes; |
int planes; |
66 |
int type; |
int type; |
67 |
|
|
68 |
int irq_nr; |
struct interrupt irq; |
69 |
int interrupts_enable; |
int interrupts_enable; |
70 |
int interrupt_time; |
int interrupt_time; |
71 |
int interrupt_time_reset_value; |
int interrupt_time_reset_value; |
271 |
* or after another tick has passed. (This is to prevent |
* or after another tick has passed. (This is to prevent |
272 |
* lockups from unhandled interrupts.) |
* lockups from unhandled interrupts.) |
273 |
*/ |
*/ |
274 |
if (d->type != BT459_PX && d->interrupts_enable && d->irq_nr > 0) { |
if (d->type != BT459_PX && d->interrupts_enable) { |
275 |
d->interrupt_time --; |
d->interrupt_time --; |
276 |
if (d->interrupt_time < 0) { |
if (d->interrupt_time < 0) { |
277 |
d->interrupt_time = d->interrupt_time_reset_value; |
d->interrupt_time = d->interrupt_time_reset_value; |
278 |
cpu_interrupt(cpu, d->irq_nr); |
INTERRUPT_ASSERT(d->irq); |
279 |
} else |
} else |
280 |
cpu_interrupt_ack(cpu, d->irq_nr); |
INTERRUPT_DEASSERT(d->irq); |
281 |
} |
} |
282 |
} |
} |
283 |
|
|
284 |
|
|
|
/* |
|
|
* dev_bt459_irq_access(): |
|
|
*/ |
|
285 |
DEVICE_ACCESS(bt459_irq) |
DEVICE_ACCESS(bt459_irq) |
286 |
{ |
{ |
287 |
struct bt459_data *d = (struct bt459_data *) extra; |
struct bt459_data *d = (struct bt459_data *) extra; |
295 |
#endif |
#endif |
296 |
|
|
297 |
d->interrupts_enable = 1; |
d->interrupts_enable = 1; |
298 |
if (d->irq_nr > 0) |
|
299 |
cpu_interrupt_ack(cpu, d->irq_nr); |
INTERRUPT_DEASSERT(d->irq); |
300 |
|
|
301 |
if (writeflag == MEM_READ) |
if (writeflag == MEM_READ) |
302 |
memory_writemax64(cpu, data, len, odata); |
memory_writemax64(cpu, data, len, odata); |
327 |
* accessing a normal BT459 register, or the irq register, |
* accessing a normal BT459 register, or the irq register, |
328 |
* or by simply "missing" it. |
* or by simply "missing" it. |
329 |
*/ |
*/ |
330 |
if (d->irq_nr > 0) |
INTERRUPT_DEASSERT(d->irq); |
|
cpu_interrupt_ack(cpu, d->irq_nr); |
|
331 |
|
|
332 |
/* ID register is read-only, should always be 0x4a or 0x4a4a4a: */ |
/* ID register is read-only, should always be 0x4a or 0x4a4a4a: */ |
333 |
if (d->planes == 24) |
if (d->planes == 24) |
526 |
*/ |
*/ |
527 |
void dev_bt459_init(struct machine *machine, struct memory *mem, |
void dev_bt459_init(struct machine *machine, struct memory *mem, |
528 |
uint64_t baseaddr, uint64_t baseaddr_irq, struct vfb_data *vfb_data, |
uint64_t baseaddr, uint64_t baseaddr_irq, struct vfb_data *vfb_data, |
529 |
int planes, int irq_nr, int type) |
int planes, char *irq_path, int type) |
530 |
{ |
{ |
531 |
struct bt459_data *d = malloc(sizeof(struct bt459_data)); |
struct bt459_data *d = malloc(sizeof(struct bt459_data)); |
532 |
if (d == NULL) { |
if (d == NULL) { |
536 |
|
|
537 |
memset(d, 0, sizeof(struct bt459_data)); |
memset(d, 0, sizeof(struct bt459_data)); |
538 |
|
|
539 |
|
INTERRUPT_CONNECT(irq_path, d->irq); |
540 |
|
|
541 |
d->vfb_data = vfb_data; |
d->vfb_data = vfb_data; |
542 |
d->rgb_palette = vfb_data->rgb_palette; |
d->rgb_palette = vfb_data->rgb_palette; |
543 |
d->planes = planes; |
d->planes = planes; |
|
d->irq_nr = irq_nr; |
|
544 |
d->type = type; |
d->type = type; |
545 |
d->cursor_x = -1; |
d->cursor_x = -1; |
546 |
d->cursor_y = -1; |
d->cursor_y = -1; |