summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2012-05-17 02:30:01 +0200
committerDavid Lamparter <equinox@diac24.net>2012-05-17 02:30:01 +0200
commita09ebf4a690b86b7cc629d3c1a9e18c4ab4fc097 (patch)
treee2303c64a058d792ff8af4d28e37e49bbb4ee640
parent937ce1ef539a7a73d481e9392c27b860d9b5eb14 (diff)
uart: volatile/uart_wait()
-rw-r--r--uart.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/uart.c b/uart.c
index fcc5783..feb9619 100644
--- a/uart.c
+++ b/uart.c
@@ -1,6 +1,6 @@
#define TXBSIZE 128
-static char txbuf[TXBSIZE];
-static uint8_t txput = 0, txsend = 0;
+static volatile char txbuf[TXBSIZE];
+static volatile uint8_t txput = 0, txsend = 0;
ISR(USART_RX_vect)
{
@@ -19,6 +19,12 @@ ISR(USART_UDRE_vect)
}
}
+static void uart_wait(void)
+{
+ while (txsend != txput)
+ asm volatile ("" : : : "memory");
+}
+
static void _uart_putch(const char ch)
{
txbuf[txput] = ch;