summaryrefslogtreecommitdiff
path: root/src/drivers/uart.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-14 22:47:15 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-14 22:47:15 +0800
commitac9741e12222e72bad3414bc6f588e70a3d130cc (patch)
tree6aace9f63a2ea54c7c3fd1e49e98ff81b638296f /src/drivers/uart.cc
parent1e862099a13266da57ff7c6de11c1a11c42a8112 (diff)
downloadlume-ac9741e12222e72bad3414bc6f588e70a3d130cc.tar.gz
lume-ac9741e12222e72bad3414bc6f588e70a3d130cc.tar.xz
feat: implement FDT-based memory discovery and add comprehensive debug logging to exec syscalls
Diffstat (limited to 'src/drivers/uart.cc')
-rw-r--r--src/drivers/uart.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/drivers/uart.cc b/src/drivers/uart.cc
index 96ae182..397a402 100644
--- a/src/drivers/uart.cc
+++ b/src/drivers/uart.cc
@@ -40,29 +40,29 @@ namespace Drivers
uart_rx.w = 0;
// Disable interrupts and configure
- *(volatile uint8 *)(UART0 + IER) = 0x00;
+ *(volatile uint8 *)(uart_base() + IER) = 0x00;
// Enter baud rate setting mode (LCR_DLAB) = 0x80;
- *(volatile uint8 *)(UART0 + LCR) = 0x80;
- *(volatile uint8 *)(UART0 + 0) = 0x03; // DLL: 38.4K baud
- *(volatile uint8 *)(UART0 + 1) = 0x00; // DLM
+ *(volatile uint8 *)(uart_base() + LCR) = 0x80;
+ *(volatile uint8 *)(uart_base() + 0) = 0x03; // DLL: 38.4K baud
+ *(volatile uint8 *)(uart_base() + 1) = 0x00; // DLM
// Exit baud rate setting, set 8-bit word length, no parity
- *(volatile uint8 *)(UART0 + LCR) = 0x03;
+ *(volatile uint8 *)(uart_base() + LCR) = 0x03;
// Reset and enable FIFO
- *(volatile uint8 *)(UART0 + FCR) = 0x07;
+ *(volatile uint8 *)(uart_base() + FCR) = 0x07;
// Enable Receive Data Available Interrupt
- *(volatile uint8 *)(UART0 + IER) = 0x01;
+ *(volatile uint8 *)(uart_base() + IER) = 0x01;
}
void uart_putc(char c)
{
uart_tx_lock.acquire();
- while ((*(volatile uint8 *)(UART0 + LSR) & LSR_TX_IDLE) == 0)
+ while ((*(volatile uint8 *)(uart_base() + LSR) & LSR_TX_IDLE) == 0)
;
- *(volatile uint8 *)(UART0 + THR) = c;
+ *(volatile uint8 *)(uart_base() + THR) = c;
uart_tx_lock.release();
}
@@ -113,10 +113,10 @@ namespace Drivers
while (1)
{
- if ((*(volatile uint8 *)(UART0 + LSR) & LSR_RX_READY) == 0)
+ if ((*(volatile uint8 *)(uart_base() + LSR) & LSR_RX_READY) == 0)
break;
- char c = *(volatile uint8 *)(UART0 + RHR);
+ char c = *(volatile uint8 *)(uart_base() + RHR);
uart_rx.buf[uart_rx.w % UART_RX_BUF_SIZE] = c;
uart_rx.w++;