diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-01-03 02:19:57 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-01-03 02:19:57 +0800 |
| commit | 210025560c80b48af4875af199f183ad709e3bf0 (patch) | |
| tree | eb11aeb7b641187f207e3b572c5184cf3526b463 /include/drivers/uart.h | |
| parent | bde87490d61135dcaa94d9b1489ff6c39876d169 (diff) | |
| parent | 10614e04929a6d109a5e90524e446b637aaf0c13 (diff) | |
| download | lume-210025560c80b48af4875af199f183ad709e3bf0.tar.gz lume-210025560c80b48af4875af199f183ad709e3bf0.tar.xz | |
Merge pull request #4 from Richard-Qin-001/dev/shell
Rebuilt the system's underlying structure; it is now stable enough to merge.
The system now supports a read-only file system and has a simple shell implemented.
Diffstat (limited to 'include/drivers/uart.h')
| -rw-r--r-- | include/drivers/uart.h | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/include/drivers/uart.h b/include/drivers/uart.h index 4d00d94..26c2394 100644 --- a/include/drivers/uart.h +++ b/include/drivers/uart.h @@ -1,9 +1,36 @@ #pragma once -typedef unsigned long long uint64_t; +#include "common/types.h" -namespace Drivers { +#define UART0 0x10000000L +#define RHR 0 // Receive Holding Register (read mode) +#define THR 0 // Transmit Holding Register (write mode) +#define IER 1 // Interrupt Enable Register +#define FCR 2 // FIFO Control Register +#define ISR 2 // Interrupt Status Register +#define LCR 3 // Line Control Register +#define LSR 5 // Line Status Register + +#define LSR_RX_READY 0x01 // input is waiting to be read from RHR +#define LSR_TX_IDLE 0x20 // THR can accept another character to send + +#define UART_RX_BUF_SIZE 128 + +// ANSI Escape Codes for Modern Terminal Colors +#define ANSI_RESET "\033[0m" +#define ANSI_RED "\033[31m" +#define ANSI_GREEN "\033[32m" +#define ANSI_YELLOW "\033[33m" +#define ANSI_BLUE "\033[34m" +#define ANSI_CLEAR "\033[2J\033[1;1H" + +namespace Drivers +{ void uart_init(); + void uart_intr(); + int console_read(uint64 target, int len); + void uart_putc(char c); - void uart_puts(const char* s); - void print_hex(uint64_t val); + void uart_puts(const char *s); + void uart_put_int(int value); + void print_hex(uint64 value); }
\ No newline at end of file |
