Bring up minos on the Allwinner D1 (Lichee RV) over FEL/xfel and add bidirectional UART so the console can read keystrokes, not just print. D1 / Lichee RV boot: - riscv arch.c: select UART0 base by -DBOARD_D1 (0x02500000 vs QEMU 0x10000000) and add a reg-shift abstraction (uart_rd/uart_wr): the D1's Synopsys DW-8250 uses 32-bit registers at 4-byte spacing, which is what made the first hardware boot silent. - d1_uart0_init(): gate/deassert UART0 clock, mux PB8/PB9 to UART0, set 115200 8N1, clear FIFOs, force non-loopback, drain stale RX. - link-d1.ld: link for DRAM at 0x40000000 (xfel exec target, M-mode). - Makefile: 'lichee' builds the flat binary; 'run-lichee' loads it via xfel (ddr d1 / write / exec). - arch_name() reports the concrete board. UART input (all archs): - arch contract gains arch_uart_getc() and arch_uart_rx_ready(), implemented for riscv, x86 (COM1) and arm (Cadence UART). - console gains getc() and drain_rx(). - kmain() runs an interactive echo loop (seed of the M3 console). Verified: echo works under QEMU on x86/riscv/arm, and on real D1 hardware (banner once, then live keystroke echo over UART0 @115200).
41 lines
1.5 KiB
C
41 lines
1.5 KiB
C
/* arch.h — the per-arch contract.
|
|
*
|
|
* The common C core is arch-agnostic: it only calls these functions.
|
|
* Each arch/<name>/ provides an implementation. This is the whole
|
|
* "boundary" between the minimal asm/glue and the portable C.
|
|
*/
|
|
#ifndef MINOS_ARCH_H
|
|
#define MINOS_ARCH_H
|
|
|
|
/* Early, arch-specific bring-up done before kmain() prints anything:
|
|
* e.g. point UART at the right MMIO/port. Called from the asm entry's
|
|
* C landing pad, or the very top of kmain(). */
|
|
void arch_early_init(void);
|
|
|
|
/* Emit one byte to the platform's debug UART. The console layer in
|
|
* common/console.c builds print()/puts() on top of just this. */
|
|
void arch_uart_putc(char c);
|
|
|
|
/* Blocking read of one byte from the debug UART (polls the RX FIFO).
|
|
* The UART is full-duplex, so this is the mirror of arch_uart_putc. */
|
|
char arch_uart_getc(void);
|
|
|
|
/* Non-blocking: return 1 if a received byte is waiting, else 0. Lets the
|
|
* console drain any stale/echoed RX bytes without blocking. */
|
|
int arch_uart_rx_ready(void);
|
|
|
|
/* Install the interrupt/trap vector table (IDT / mtvec / VBAR).
|
|
* M1 stubs this; M2 makes it handle a timer tick. */
|
|
void arch_set_trap_vector(void);
|
|
|
|
/* Name of the architecture, for the banner. */
|
|
const char *arch_name(void);
|
|
|
|
/* Human-readable current CPU privilege mode (e.g. "ring0", "M-mode",
|
|
* "SVC"). Reads the live hardware state so the banner proves it. */
|
|
const char *arch_cpu_mode(void);
|
|
|
|
/* Halt the CPU (wfi / hlt) — end of kmain(). */
|
|
void arch_halt(void) __attribute__((noreturn));
|
|
|
|
#endif /* MINOS_ARCH_H */
|