--- trunk/src/devices/dev_ns16550.c 2007/10/08 16:19:11 18 +++ trunk/src/devices/dev_ns16550.c 2007/10/08 16:19:23 20 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dev_ns16550.c,v 1.42 2005/10/26 14:37:04 debug Exp $ + * $Id: dev_ns16550.c,v 1.46 2005/11/23 18:16:42 debug Exp $ * * NS16550 serial controller. * @@ -62,7 +62,7 @@ unsigned char reg[DEV_NS16550_LENGTH]; unsigned char fcr; /* FIFO control register */ - + int int_asserted; int dlab; /* Divisor Latch Access bit */ int divisor; @@ -94,11 +94,15 @@ if (((d->reg[com_ier] & IER_ETXRDY) && (d->reg[com_iir] & IIR_TXRDY)) || ((d->reg[com_ier] & IER_ERXRDY) && (d->reg[com_iir] & IIR_RXRDY))) { d->reg[com_iir] &= ~IIR_NOPEND; - if (d->reg[com_mcr] & MCR_IENABLE) + if (d->reg[com_mcr] & MCR_IENABLE) { cpu_interrupt(cpu, d->irqnr); + d->int_asserted = 1; + } } else { d->reg[com_iir] |= IIR_NOPEND; - cpu_interrupt_ack(cpu, d->irqnr); + if (d->int_asserted) + cpu_interrupt_ack(cpu, d->irqnr); + d->int_asserted = 0; } } @@ -117,10 +121,12 @@ if (writeflag == MEM_WRITE) idata = memory_readmax64(cpu, data, len); +#if 0 /* The NS16550 should be accessed using byte read/writes: */ if (len != 1) fatal("[ ns16550 (%s): len=%i, idata=0x%16llx! ]\n", d->name, len, (long long)idata); +#endif /* * Always ready to transmit: @@ -160,10 +166,13 @@ /* Read/write of data: */ if (writeflag == MEM_WRITE) { - if (d->reg[com_mcr] & MCR_LOOPBACK) + if (d->reg[com_mcr] & MCR_LOOPBACK) { console_makeavail(d->console_handle, idata); - else + } else { console_putchar(d->console_handle, idata); + if (console_are_slaves_allowed()) + d->in_use = 1; + } d->reg[com_iir] |= IIR_TXRDY; } else { if (d->in_use) @@ -356,7 +365,7 @@ memory_device_register(devinit->machine->memory, name, devinit->addr, DEV_NS16550_LENGTH * d->addrmult, dev_ns16550_access, d, - MEM_DEFAULT, NULL); + DM_DEFAULT, NULL); machine_add_tickfunction(devinit->machine, dev_ns16550_tick, d, TICK_SHIFT);