summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/usart.c
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-06-10 17:47:36 +0200
committerNao Pross <naopross@thearcway.org>2017-06-10 17:47:36 +0200
commitb96b0d6c00ea72895582ec14f9c7dccd3fe7062a (patch)
tree1d92b474bfd2aaf7d6cc951b7ab55cfc2f0d435e /sw/z80/kernel/usart.c
parentadd serial interface and a few std library functions (diff)
downloadz80uPC-b96b0d6c00ea72895582ec14f9c7dccd3fe7062a.tar.gz
z80uPC-b96b0d6c00ea72895582ec14f9c7dccd3fe7062a.zip
add port interface header, api still to implement
fix for bug in usart.c, in function usart_write() that checked the trasmission_empty register at the wrong time causing it to overwrite the buffer.
Diffstat (limited to '')
-rw-r--r--sw/z80/kernel/usart.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/z80/kernel/usart.c b/sw/z80/kernel/usart.c
index 4c2fdaf..9ec6dbd 100644
--- a/sw/z80/kernel/usart.c
+++ b/sw/z80/kernel/usart.c
@@ -65,8 +65,8 @@ int usart_write(uint8_t *data, size_t size)
while (size--) {
_usart->buffer = *(dp++);
+ while (_usart->LSR.transmitter_empty);
}
- while (_usart->LSR.transmitter_empty);
// TODO: do something that actually counts for sent bytes
return size;
@@ -83,7 +83,7 @@ int usart_read(uint8_t *buffer, size_t count)
if (_usart->LSR.framing_error || _usart->LSR.parity_error) {
bp--; // delete last byte (?)
} else {
- read_count++;
+ read_count++;
}
}