Skip to content

Commit

Permalink
uart: throw rdi instead of cti when fifo is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Jul 11, 2022
1 parent f13136b commit aff546c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function UART(cpu, port, bus)
{
this.lsr &= ~UART_LSR_DATA_READY;
this.ClearInterrupt(UART_IIR_CTI);
this.ClearInterrupt(UART_IIR_RDI);
}

return data;
Expand Down Expand Up @@ -281,6 +282,10 @@ UART.prototype.CheckInterrupt = function() {
this.iir = UART_IIR_CTI;
this.cpu.device_raise_irq(this.irq);
} else
if ((this.ints & (1 << UART_IIR_RDI)) && (this.ier & UART_IER_RDI)) {
this.iir = UART_IIR_RDI;
this.cpu.device_raise_irq(this.irq);
} else
if ((this.ints & (1 << UART_IIR_THRI)) && (this.ier & UART_IER_THRI)) {
this.iir = UART_IIR_THRI;
this.cpu.device_raise_irq(this.irq);
Expand Down Expand Up @@ -313,7 +318,15 @@ UART.prototype.data_received = function(data)
this.input.push(data);

this.lsr |= UART_LSR_DATA_READY;
this.ThrowInterrupt(UART_IIR_CTI);

if(this.fifo_control & 1)
{
this.ThrowInterrupt(UART_IIR_CTI);
}
else
{
this.ThrowInterrupt(UART_IIR_RDI);
}
};

UART.prototype.write_data = function(out_byte)
Expand Down

0 comments on commit aff546c

Please sign in to comment.