/*
* Milkymist SoC (Software)
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010, 2012 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <hw/common.h>
#define CSR_UART_RXTX MMPTR(0xe0000000)
-#define CSR_UART_DIVISOR MMPTR(0xe0000004)
-#define CSR_UART_STAT MMPTR(0xe0000008)
-#define CSR_UART_CTRL MMPTR(0xe000000c)
-#define CSR_UART_DEBUG MMPTR(0xe0000010)
+#define CSR_UART_DIVISORH MMPTR(0xe0000004)
+#define CSR_UART_DIVISORL MMPTR(0xe0000008)
-#define UART_STAT_THRE (0x1)
-#define UART_STAT_RX_EVT (0x2)
-#define UART_STAT_TX_EVT (0x4)
+#define CSR_UART_EV_STAT MMPTR(0xe000000c)
+#define CSR_UART_EV_PENDING MMPTR(0xe0000010)
+#define CSR_UART_EV_ENABLE MMPTR(0xe0000014)
-#define UART_CTRL_RX_INT (0x1)
-#define UART_CTRL_TX_INT (0x2)
-#define UART_CTRL_THRU (0x4)
-
-#define UART_DEBUG_BREAK_EN (0x1)
+#define UART_EV_TX (0x1)
+#define UART_EV_RX (0x2)
#endif /* __HW_UART_H */
void uart_isr(void)
{
- unsigned int stat = CSR_UART_STAT;
+ unsigned int stat = CSR_UART_EV_PENDING;
- if(stat & UART_STAT_RX_EVT) {
+ if(stat & UART_EV_RX) {
rx_buf[rx_produce] = CSR_UART_RXTX;
rx_produce = (rx_produce + 1) & UART_RINGBUFFER_MASK_RX;
}
- if(stat & UART_STAT_TX_EVT) {
+ if(stat & UART_EV_TX) {
if(tx_produce != tx_consume) {
CSR_UART_RXTX = tx_buf[tx_consume];
tx_consume = (tx_consume + 1) & UART_RINGBUFFER_MASK_TX;
tx_cts = 1;
}
- CSR_UART_STAT = stat;
+ CSR_UART_EV_PENDING = stat;
irq_ack(IRQ_UART);
}
irq_ack(IRQ_UART);
/* ack any events */
- CSR_UART_STAT = CSR_UART_STAT;
+ CSR_UART_EV_PENDING = CSR_UART_EV_PENDING;
/* enable interrupts */
- CSR_UART_CTRL = UART_CTRL_TX_INT | UART_CTRL_RX_INT;
+ CSR_UART_EV_ENABLE = UART_EV_TX | UART_EV_RX;
mask = irq_getmask();
mask |= IRQ_UART;